-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #100844 - evopen:migrate-diag, r=davidtwco
migrate rustc_query_system to use SessionDiagnostic issues: * variable list is not supported in fluent * ~~cannot have two sub diagnostic with the same tag (eg. 2 .note or 2 .help)~~ allow multiple tag with SessionSubdiagnostic derive
- Loading branch information
Showing
10 changed files
with
475 additions
and
804 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
compiler/rustc_error_messages/locales/en-US/query_system.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
query_system_reentrant = internal compiler error: re-entrant incremental verify failure, suppressing message | ||
query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node} | ||
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile | ||
query_system_increment_compilation_note1 = Please follow the instructions below to create a bug report with the provided information | ||
query_system_increment_compilation_note2 = See <https://github.com/rust-lang/rust/issues/84970> for more information | ||
query_system_cycle = cycle detected when {$stack_bottom} | ||
query_system_cycle_usage = cycle used when {$usage} | ||
query_system_cycle_stack_single = ...which immediately requires {$stack_bottom} again | ||
query_system_cycle_stack_multiple = ...which again requires {$stack_bottom}, completing the cycle | ||
query_system_cycle_recursive_ty_alias = type aliases cannot be recursive | ||
query_system_cycle_recursive_ty_alias_help1 = consider using a struct, enum, or union instead to break the cycle | ||
query_system_cycle_recursive_ty_alias_help2 = see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | ||
query_system_cycle_recursive_trait_alias = trait aliases cannot be recursive | ||
query_system_cycle_which_requires = ...which requires {$desc}... | ||
query_system_query_overflow = queries overflow the depth limit! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
694 changes: 249 additions & 445 deletions
694
compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
use rustc_errors::AddSubdiagnostic; | ||
use rustc_span::Span; | ||
|
||
pub struct CycleStack { | ||
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(SessionSubdiagnostic)] | ||
pub enum StackCount { | ||
#[note(query_system::cycle_stack_single)] | ||
Single, | ||
#[note(query_system::cycle_stack_multiple)] | ||
Multiple, | ||
} | ||
|
||
#[derive(SessionSubdiagnostic)] | ||
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, | ||
} | ||
|
||
#[derive(SessionSubdiagnostic)] | ||
#[note(query_system::cycle_usage)] | ||
pub struct CycleUsage { | ||
#[primary_span] | ||
pub span: Span, | ||
pub usage: String, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[diag(query_system::cycle, code = "E0391")] | ||
pub struct Cycle { | ||
#[primary_span] | ||
pub span: Span, | ||
pub stack_bottom: String, | ||
#[subdiagnostic] | ||
pub cycle_stack: Vec<CycleStack>, | ||
#[subdiagnostic] | ||
pub stack_count: StackCount, | ||
#[subdiagnostic] | ||
pub alias: Option<Alias>, | ||
#[subdiagnostic] | ||
pub cycle_usage: Option<CycleUsage>, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[diag(query_system::reentrant)] | ||
pub struct Reentrant; | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[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, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[diag(query_system::query_overflow)] | ||
pub struct QueryOverflow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.