Convert to inline diagnostics in rustc_query_system
This commit is contained in:
parent
5e30860d31
commit
30f82aac5b
7 changed files with 27 additions and 56 deletions
|
|
@ -3812,7 +3812,6 @@ dependencies = [
|
|||
"rustc_pattern_analysis",
|
||||
"rustc_privacy",
|
||||
"rustc_public",
|
||||
"rustc_query_system",
|
||||
"rustc_resolve",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
|
|
@ -4572,7 +4571,6 @@ dependencies = [
|
|||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
"rustc_fluent_macro",
|
||||
"rustc_hashes",
|
||||
"rustc_hir",
|
||||
"rustc_index",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ rustc_passes = { path = "../rustc_passes" }
|
|||
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
|
||||
rustc_privacy = { path = "../rustc_privacy" }
|
||||
rustc_public = { path = "../rustc_public", features = ["rustc_internal"] }
|
||||
rustc_query_system = { path = "../rustc_query_system" }
|
||||
rustc_resolve = { path = "../rustc_resolve" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
|
|||
rustc_passes::DEFAULT_LOCALE_RESOURCE,
|
||||
rustc_pattern_analysis::DEFAULT_LOCALE_RESOURCE,
|
||||
rustc_privacy::DEFAULT_LOCALE_RESOURCE,
|
||||
rustc_query_system::DEFAULT_LOCALE_RESOURCE,
|
||||
rustc_resolve::DEFAULT_LOCALE_RESOURCE,
|
||||
rustc_session::DEFAULT_LOCALE_RESOURCE,
|
||||
rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ rustc_ast = { path = "../rustc_ast" }
|
|||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||
rustc_hashes = { path = "../rustc_hashes" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
query_system_cycle = cycle detected when {$stack_bottom}
|
||||
.note = see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
query_system_cycle_recursive_trait_alias = trait aliases cannot be recursive
|
||||
|
||||
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_stack_middle = ...which requires {$desc}...
|
||||
|
||||
query_system_cycle_stack_multiple = ...which again requires {$stack_bottom}, completing the cycle
|
||||
|
||||
query_system_cycle_stack_single = ...which immediately requires {$stack_bottom} again
|
||||
|
||||
query_system_cycle_usage = cycle used when {$usage}
|
||||
|
||||
query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
|
||||
|
||||
query_system_increment_compilation_note1 = please follow the instructions below to create a bug report with the provided information
|
||||
query_system_increment_compilation_note2 = for incremental compilation bugs, having a reproduction is vital
|
||||
query_system_increment_compilation_note3 = an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again
|
||||
query_system_increment_compilation_note4 = as a workaround, you can run {$run_cmd} to allow your project to compile
|
||||
|
||||
query_system_overflow_note = query depth increased by {$depth} when {$desc}
|
||||
|
||||
query_system_query_overflow = queries overflow the depth limit!
|
||||
.help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`)
|
||||
|
||||
query_system_reentrant = internal compiler error: reentrant incremental verify failure, suppressing message
|
||||
|
|
@ -4,7 +4,7 @@ use rustc_macros::{Diagnostic, Subdiagnostic};
|
|||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(query_system_cycle_stack_middle)]
|
||||
#[note("...which requires {$desc}...")]
|
||||
pub(crate) struct CycleStack {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
|
@ -13,24 +13,26 @@ pub(crate) struct CycleStack {
|
|||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum StackCount {
|
||||
#[note(query_system_cycle_stack_single)]
|
||||
#[note("...which immediately requires {$stack_bottom} again")]
|
||||
Single,
|
||||
#[note(query_system_cycle_stack_multiple)]
|
||||
#[note("...which again requires {$stack_bottom}, completing the cycle")]
|
||||
Multiple,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) 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("type aliases cannot be recursive")]
|
||||
#[help("consider using a struct, enum, or union instead to break the cycle")]
|
||||
#[help(
|
||||
"see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information"
|
||||
)]
|
||||
Ty,
|
||||
#[note(query_system_cycle_recursive_trait_alias)]
|
||||
#[note("trait aliases cannot be recursive")]
|
||||
Trait,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(query_system_cycle_usage)]
|
||||
#[note("cycle used when {$usage}")]
|
||||
pub(crate) struct CycleUsage {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
|
@ -38,7 +40,7 @@ pub(crate) struct CycleUsage {
|
|||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(query_system_cycle, code = E0391)]
|
||||
#[diag("cycle detected when {$stack_bottom}", code = E0391)]
|
||||
pub(crate) struct Cycle {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
|
@ -51,28 +53,34 @@ pub(crate) struct Cycle {
|
|||
pub alias: Option<Alias>,
|
||||
#[subdiagnostic]
|
||||
pub cycle_usage: Option<CycleUsage>,
|
||||
#[note]
|
||||
#[note(
|
||||
"see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information"
|
||||
)]
|
||||
pub note_span: (),
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(query_system_reentrant)]
|
||||
#[diag("internal compiler error: reentrant incremental verify failure, suppressing message")]
|
||||
pub(crate) struct Reentrant;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(query_system_increment_compilation)]
|
||||
#[note(query_system_increment_compilation_note1)]
|
||||
#[note(query_system_increment_compilation_note2)]
|
||||
#[note(query_system_increment_compilation_note3)]
|
||||
#[note(query_system_increment_compilation_note4)]
|
||||
#[diag("internal compiler error: encountered incremental compilation error with {$dep_node}")]
|
||||
#[note("please follow the instructions below to create a bug report with the provided information")]
|
||||
#[note("for incremental compilation bugs, having a reproduction is vital")]
|
||||
#[note(
|
||||
"an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again"
|
||||
)]
|
||||
#[note("as a workaround, you can run {$run_cmd} to allow your project to compile")]
|
||||
pub(crate) struct IncrementCompilation {
|
||||
pub run_cmd: String,
|
||||
pub dep_node: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[help]
|
||||
#[diag(query_system_query_overflow)]
|
||||
#[help(
|
||||
"consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]` attribute to your crate (`{$crate_name}`)"
|
||||
)]
|
||||
#[diag("queries overflow the depth limit!")]
|
||||
pub struct QueryOverflow {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
|
@ -83,7 +91,7 @@ pub struct QueryOverflow {
|
|||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(query_system_overflow_note)]
|
||||
#[note("query depth increased by {$depth} when {$desc}")]
|
||||
pub struct QueryOverflowNote {
|
||||
pub desc: String,
|
||||
pub depth: usize,
|
||||
|
|
|
|||
|
|
@ -14,5 +14,3 @@ mod values;
|
|||
|
||||
pub use error::{QueryOverflow, QueryOverflowNote};
|
||||
pub use values::Value;
|
||||
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue