2022-09-15 04:01:44 +00:00
|
|
|
use rustc_macros::{Diagnostic, Subdiagnostic};
|
2022-09-15 07:45:17 +00:00
|
|
|
use rustc_session::Limit;
|
|
|
|
use rustc_span::{Span, Symbol};
|
2022-08-21 13:37:05 +00:00
|
|
|
|
2022-10-03 13:26:29 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[note(query_system::cycle_stack_middle)]
|
2022-08-23 03:19:38 +00:00
|
|
|
pub struct CycleStack {
|
2022-10-03 13:26:29 +00:00
|
|
|
#[primary_span]
|
2022-08-21 13:37:05 +00:00
|
|
|
pub span: Span,
|
2022-08-23 03:19:38 +00:00
|
|
|
pub desc: String,
|
2022-08-21 13:37:05 +00:00
|
|
|
}
|
|
|
|
|
2022-09-02 01:43:12 +00:00
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub enum HandleCycleError {
|
|
|
|
Error,
|
|
|
|
Fatal,
|
|
|
|
DelayBug,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:47:31 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-23 03:19:38 +00:00
|
|
|
pub enum StackCount {
|
|
|
|
#[note(query_system::cycle_stack_single)]
|
|
|
|
Single,
|
|
|
|
#[note(query_system::cycle_stack_multiple)]
|
|
|
|
Multiple,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:47:31 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-23 03:19:38 +00:00
|
|
|
pub enum Alias {
|
|
|
|
#[note(query_system::cycle_recursive_ty_alias)]
|
|
|
|
#[help(query_system::cycle_recursive_ty_alias_help1)]
|
|
|
|
#[help(query_system::cycle_recursive_ty_alias_help2)]
|
|
|
|
Ty,
|
|
|
|
#[note(query_system::cycle_recursive_trait_alias)]
|
|
|
|
Trait,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:47:31 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-23 03:19:38 +00:00
|
|
|
#[note(query_system::cycle_usage)]
|
|
|
|
pub struct CycleUsage {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub usage: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-23 03:19:38 +00:00
|
|
|
#[diag(query_system::cycle, code = "E0391")]
|
|
|
|
pub struct Cycle {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub stack_bottom: String,
|
2022-10-03 13:26:29 +00:00
|
|
|
#[subdiagnostic(eager)]
|
2022-08-23 03:19:38 +00:00
|
|
|
pub cycle_stack: Vec<CycleStack>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub stack_count: StackCount,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub alias: Option<Alias>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub cycle_usage: Option<CycleUsage>,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-21 13:37:05 +00:00
|
|
|
#[diag(query_system::reentrant)]
|
|
|
|
pub struct Reentrant;
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-21 13:37:05 +00:00
|
|
|
#[diag(query_system::increment_compilation)]
|
|
|
|
#[help]
|
|
|
|
#[note(query_system::increment_compilation_note1)]
|
|
|
|
#[note(query_system::increment_compilation_note2)]
|
|
|
|
pub struct IncrementCompilation {
|
|
|
|
pub run_cmd: String,
|
|
|
|
pub dep_node: String,
|
|
|
|
}
|
2022-08-27 03:55:38 +00:00
|
|
|
|
2022-09-18 15:45:41 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-09-15 07:45:17 +00:00
|
|
|
#[help]
|
2022-08-27 03:55:38 +00:00
|
|
|
#[diag(query_system::query_overflow)]
|
2022-09-14 13:00:00 +00:00
|
|
|
pub struct QueryOverflow {
|
2022-09-15 07:45:17 +00:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Option<Span>,
|
2022-09-14 13:00:00 +00:00
|
|
|
#[subdiagnostic]
|
|
|
|
pub layout_of_depth: Option<LayoutOfDepth>,
|
2022-09-15 07:45:17 +00:00
|
|
|
pub suggested_limit: Limit,
|
|
|
|
pub crate_name: Symbol,
|
2022-09-14 13:00:00 +00:00
|
|
|
}
|
|
|
|
|
2022-09-18 15:45:41 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-09-14 13:00:00 +00:00
|
|
|
#[note(query_system::layout_of_depth)]
|
|
|
|
pub struct LayoutOfDepth {
|
|
|
|
pub desc: String,
|
|
|
|
pub depth: usize,
|
|
|
|
}
|