From 20431706a863f92cb37dc512fef6e48d192aaf2c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_query_system/src/error.rs | 73 +++++++++++++++++++------------- 1 file changed, 43 insertions(+), 30 deletions(-) (limited to 'compiler/rustc_query_system/src/error.rs') diff --git a/compiler/rustc_query_system/src/error.rs b/compiler/rustc_query_system/src/error.rs index 3fb06cbed..7a20eaceb 100644 --- a/compiler/rustc_query_system/src/error.rs +++ b/compiler/rustc_query_system/src/error.rs @@ -1,17 +1,15 @@ -use rustc_errors::AddSubdiagnostic; -use rustc_span::Span; +use rustc_macros::{Diagnostic, Subdiagnostic}; +use rustc_session::Limit; +use rustc_span::{Span, Symbol}; +#[derive(Subdiagnostic)] +#[note(query_system_cycle_stack_middle)] pub struct CycleStack { + #[primary_span] pub span: Span, pub desc: String, } -impl AddSubdiagnostic for CycleStack { - fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { - diag.span_note(self.span, &format!("...which requires {}...", self.desc)); - } -} - #[derive(Copy, Clone)] pub enum HandleCycleError { Error, @@ -19,39 +17,39 @@ pub enum HandleCycleError { DelayBug, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub enum StackCount { - #[note(query_system::cycle_stack_single)] + #[note(query_system_cycle_stack_single)] Single, - #[note(query_system::cycle_stack_multiple)] + #[note(query_system_cycle_stack_multiple)] Multiple, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] 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)] + #[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)] + #[note(query_system_cycle_recursive_trait_alias)] Trait, } -#[derive(SessionSubdiagnostic)] -#[note(query_system::cycle_usage)] +#[derive(Subdiagnostic)] +#[note(query_system_cycle_usage)] pub struct CycleUsage { #[primary_span] pub span: Span, pub usage: String, } -#[derive(SessionDiagnostic)] -#[diag(query_system::cycle, code = "E0391")] +#[derive(Diagnostic)] +#[diag(query_system_cycle, code = "E0391")] pub struct Cycle { #[primary_span] pub span: Span, pub stack_bottom: String, - #[subdiagnostic] + #[subdiagnostic(eager)] pub cycle_stack: Vec, #[subdiagnostic] pub stack_count: StackCount, @@ -61,20 +59,35 @@ pub struct Cycle { pub cycle_usage: Option, } -#[derive(SessionDiagnostic)] -#[diag(query_system::reentrant)] +#[derive(Diagnostic)] +#[diag(query_system_reentrant)] pub struct Reentrant; -#[derive(SessionDiagnostic)] -#[diag(query_system::increment_compilation)] +#[derive(Diagnostic)] +#[diag(query_system_increment_compilation)] #[help] -#[note(query_system::increment_compilation_note1)] -#[note(query_system::increment_compilation_note2)] +#[note(query_system_increment_compilation_note1)] +#[note(query_system_increment_compilation_note2)] pub struct IncrementCompilation { pub run_cmd: String, pub dep_node: String, } -#[derive(SessionDiagnostic)] -#[diag(query_system::query_overflow)] -pub struct QueryOverflow; +#[derive(Diagnostic)] +#[help] +#[diag(query_system_query_overflow)] +pub struct QueryOverflow { + #[primary_span] + pub span: Option, + #[subdiagnostic] + pub layout_of_depth: Option, + pub suggested_limit: Limit, + pub crate_name: Symbol, +} + +#[derive(Subdiagnostic)] +#[note(query_system_layout_of_depth)] +pub struct LayoutOfDepth { + pub desc: String, + pub depth: usize, +} -- cgit v1.2.3