rustc_query_system/
error.rs1use rustc_errors::codes::*;
2use rustc_hir::limit::Limit;
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::{Span, Symbol};
5
6#[derive(Subdiagnostic)]
7#[note(query_system_cycle_stack_middle)]
8pub(crate) struct CycleStack {
9 #[primary_span]
10 pub span: Span,
11 pub desc: String,
12}
13
14#[derive(Copy, Clone)]
15pub enum HandleCycleError {
16 Error,
17 Fatal,
18 DelayBug,
19 Stash,
20}
21
22#[derive(Subdiagnostic)]
23pub(crate) enum StackCount {
24 #[note(query_system_cycle_stack_single)]
25 Single,
26 #[note(query_system_cycle_stack_multiple)]
27 Multiple,
28}
29
30#[derive(Subdiagnostic)]
31pub(crate) enum Alias {
32 #[note(query_system_cycle_recursive_ty_alias)]
33 #[help(query_system_cycle_recursive_ty_alias_help1)]
34 #[help(query_system_cycle_recursive_ty_alias_help2)]
35 Ty,
36 #[note(query_system_cycle_recursive_trait_alias)]
37 Trait,
38}
39
40#[derive(Subdiagnostic)]
41#[note(query_system_cycle_usage)]
42pub(crate) struct CycleUsage {
43 #[primary_span]
44 pub span: Span,
45 pub usage: String,
46}
47
48#[derive(Diagnostic)]
49#[diag(query_system_cycle, code = E0391)]
50pub(crate) struct Cycle {
51 #[primary_span]
52 pub span: Span,
53 pub stack_bottom: String,
54 #[subdiagnostic]
55 pub cycle_stack: Vec<CycleStack>,
56 #[subdiagnostic]
57 pub stack_count: StackCount,
58 #[subdiagnostic]
59 pub alias: Option<Alias>,
60 #[subdiagnostic]
61 pub cycle_usage: Option<CycleUsage>,
62 #[note]
63 pub note_span: (),
64}
65
66#[derive(Diagnostic)]
67#[diag(query_system_reentrant)]
68pub(crate) struct Reentrant;
69
70#[derive(Diagnostic)]
71#[diag(query_system_increment_compilation)]
72#[note(query_system_increment_compilation_note1)]
73#[note(query_system_increment_compilation_note2)]
74#[note(query_system_increment_compilation_note3)]
75#[note(query_system_increment_compilation_note4)]
76pub(crate) struct IncrementCompilation {
77 pub run_cmd: String,
78 pub dep_node: String,
79}
80
81#[derive(Diagnostic)]
82#[help]
83#[diag(query_system_query_overflow)]
84pub struct QueryOverflow {
85 #[primary_span]
86 pub span: Span,
87 #[subdiagnostic]
88 pub note: QueryOverflowNote,
89 pub suggested_limit: Limit,
90 pub crate_name: Symbol,
91}
92
93#[derive(Subdiagnostic)]
94#[note(query_system_overflow_note)]
95pub struct QueryOverflowNote {
96 pub desc: String,
97 pub depth: usize,
98}