1 use rustc_errors::AddToDiagnostic;
2 use rustc_session::Limit;
3 use rustc_span::{Span, Symbol};
4 use rustc_macros::{Diagnostic, Subdiagnostic};
6 pub struct CycleStack {
11 impl AddToDiagnostic for CycleStack {
12 fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) {
13 diag.span_note(self.span, &format!("...which requires {}...", self.desc));
17 #[derive(Copy, Clone)]
18 pub enum HandleCycleError {
24 #[derive(Subdiagnostic)]
26 #[note(query_system::cycle_stack_single)]
28 #[note(query_system::cycle_stack_multiple)]
32 #[derive(Subdiagnostic)]
34 #[note(query_system::cycle_recursive_ty_alias)]
35 #[help(query_system::cycle_recursive_ty_alias_help1)]
36 #[help(query_system::cycle_recursive_ty_alias_help2)]
38 #[note(query_system::cycle_recursive_trait_alias)]
42 #[derive(Subdiagnostic)]
43 #[note(query_system::cycle_usage)]
44 pub struct CycleUsage {
51 #[diag(query_system::cycle, code = "E0391")]
55 pub stack_bottom: String,
57 pub cycle_stack: Vec<CycleStack>,
59 pub stack_count: StackCount,
61 pub alias: Option<Alias>,
63 pub cycle_usage: Option<CycleUsage>,
67 #[diag(query_system::reentrant)]
71 #[diag(query_system::increment_compilation)]
73 #[note(query_system::increment_compilation_note1)]
74 #[note(query_system::increment_compilation_note2)]
75 pub struct IncrementCompilation {
82 #[diag(query_system::query_overflow)]
83 pub struct QueryOverflow {
85 pub span: Option<Span>,
87 pub layout_of_depth: Option<LayoutOfDepth>,
88 pub suggested_limit: Limit,
89 pub crate_name: Symbol,
92 #[derive(Subdiagnostic)]
93 #[note(query_system::layout_of_depth)]
94 pub struct LayoutOfDepth {