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