rustc_query_system/
error.rs
1use rustc_errors::codes::*;
2use rustc_macros::{Diagnostic, Subdiagnostic};
3use rustc_session::Limit;
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#[help]
73#[note(query_system_increment_compilation_note1)]
74#[note(query_system_increment_compilation_note2)]
75pub(crate) struct IncrementCompilation {
76 pub run_cmd: String,
77 pub dep_node: String,
78}
79
80#[derive(Diagnostic)]
81#[help]
82#[diag(query_system_query_overflow)]
83pub struct QueryOverflow {
84 #[primary_span]
85 pub span: Span,
86 #[subdiagnostic]
87 pub note: QueryOverflowNote,
88 pub suggested_limit: Limit,
89 pub crate_name: Symbol,
90}
91
92#[derive(Subdiagnostic)]
93#[note(query_system_overflow_note)]
94pub struct QueryOverflowNote {
95 pub desc: String,
96 pub depth: usize,
97}