]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_query_system/src/error.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / compiler / rustc_query_system / src / error.rs
CommitLineData
f2b60f7d
FG
1use rustc_errors::AddSubdiagnostic;
2use rustc_span::Span;
3
4pub struct CycleStack {
5 pub span: Span,
6 pub desc: String,
7}
8
9impl 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)]
16pub enum HandleCycleError {
17 Error,
18 Fatal,
19 DelayBug,
20}
21
22#[derive(SessionSubdiagnostic)]
23pub 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)]
31pub 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)]
42pub 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")]
50pub 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)]
66pub 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)]
73pub struct IncrementCompilation {
74 pub run_cmd: String,
75 pub dep_node: String,
76}
77
78#[derive(SessionDiagnostic)]
79#[diag(query_system::query_overflow)]
80pub struct QueryOverflow;