]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_query_system/src/error.rs
Auto merge of #101527 - Kobzol:ci-update-llvm, r=Mark-Simulacrum
[rust.git] / compiler / rustc_query_system / src / error.rs
1 use rustc_errors::AddSubdiagnostic;
2 use rustc_span::Span;
3
4 pub struct CycleStack {
5     pub span: Span,
6     pub desc: String,
7 }
8
9 impl AddSubdiagnostic for CycleStack {
10     fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) {
11         diag.span_note(self.span, &format!("...which requires {}...", self.desc));
12     }
13 }
14
15 #[derive(Copy, Clone)]
16 pub enum HandleCycleError {
17     Error,
18     Fatal,
19     DelayBug,
20 }
21
22 #[derive(SessionSubdiagnostic)]
23 pub enum StackCount {
24     #[note(query_system::cycle_stack_single)]
25     Single,
26     #[note(query_system::cycle_stack_multiple)]
27     Multiple,
28 }
29
30 #[derive(SessionSubdiagnostic)]
31 pub 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(SessionSubdiagnostic)]
41 #[note(query_system::cycle_usage)]
42 pub struct CycleUsage {
43     #[primary_span]
44     pub span: Span,
45     pub usage: String,
46 }
47
48 #[derive(SessionDiagnostic)]
49 #[diag(query_system::cycle, code = "E0391")]
50 pub 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 }
63
64 #[derive(SessionDiagnostic)]
65 #[diag(query_system::reentrant)]
66 pub struct Reentrant;
67
68 #[derive(SessionDiagnostic)]
69 #[diag(query_system::increment_compilation)]
70 #[help]
71 #[note(query_system::increment_compilation_note1)]
72 #[note(query_system::increment_compilation_note2)]
73 pub struct IncrementCompilation {
74     pub run_cmd: String,
75     pub dep_node: String,
76 }
77
78 #[derive(SessionDiagnostic)]
79 #[diag(query_system::query_overflow)]
80 pub struct QueryOverflow;