Skip to content

Commit

Permalink
SessionDiagnostic for QueryOverflow error
Browse files Browse the repository at this point in the history
  • Loading branch information
evopen committed Aug 31, 2022
1 parent 166aef9 commit 7ce59eb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/query_system.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ query_system_cycle_recursive_ty_alias_help2 = see <https://doc.rust-lang.org/ref
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!
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ fluent_messages! {
passes => "../locales/en-US/passes.ftl",
plugin_impl => "../locales/en-US/plugin_impl.ftl",
privacy => "../locales/en-US/privacy.ftl",
query_system => "../locales/en-US/query_system.ftl",
save_analysis => "../locales/en-US/save_analysis.ftl",
ty_utils => "../locales/en-US/ty_utils.ftl",
typeck => "../locales/en-US/typeck.ftl",
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
query_system => "../locales/en-US/query_system.ftl",
}

pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_query_system/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ pub struct IncrementCompilation {
pub run_cmd: String,
pub dep_node: String,
}

#[derive(SessionDiagnostic)]
#[diag(query_system::query_overflow)]
pub struct QueryOverflow;
2 changes: 1 addition & 1 deletion compiler/rustc_query_system/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ pub trait QueryContext: HasDepContext {
) -> R;

fn depth_limit_error(&self) {
self.dep_context().sess().fatal("queries overflow the depth limit!");
self.dep_context().sess().emit_fatal(crate::error::QueryOverflow);
}
}

0 comments on commit 7ce59eb

Please sign in to comment.