SessionDiagnostic for QueryOverflow error

This commit is contained in:
Li Yuanheng 2022-08-27 11:55:38 +08:00
parent 166aef90fb
commit 7ce59ebf49
4 changed files with 8 additions and 2 deletions

View File

@ -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_recursive_trait_alias = trait aliases cannot be recursive
query_system_cycle_which_requires = ...which requires {$desc}... query_system_cycle_which_requires = ...which requires {$desc}...
query_system_query_overflow = queries overflow the depth limit!

View File

@ -48,11 +48,11 @@
passes => "../locales/en-US/passes.ftl", passes => "../locales/en-US/passes.ftl",
plugin_impl => "../locales/en-US/plugin_impl.ftl", plugin_impl => "../locales/en-US/plugin_impl.ftl",
privacy => "../locales/en-US/privacy.ftl", privacy => "../locales/en-US/privacy.ftl",
query_system => "../locales/en-US/query_system.ftl",
save_analysis => "../locales/en-US/save_analysis.ftl", save_analysis => "../locales/en-US/save_analysis.ftl",
ty_utils => "../locales/en-US/ty_utils.ftl", ty_utils => "../locales/en-US/ty_utils.ftl",
typeck => "../locales/en-US/typeck.ftl", typeck => "../locales/en-US/typeck.ftl",
mir_dataflow => "../locales/en-US/mir_dataflow.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}; pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};

View File

@ -67,3 +67,7 @@ pub struct IncrementCompilation {
pub run_cmd: String, pub run_cmd: String,
pub dep_node: String, pub dep_node: String,
} }
#[derive(SessionDiagnostic)]
#[diag(query_system::query_overflow)]
pub struct QueryOverflow;

View File

@ -125,6 +125,6 @@ fn start_query<R>(
) -> R; ) -> R;
fn depth_limit_error(&self) { fn depth_limit_error(&self) {
self.dep_context().sess().fatal("queries overflow the depth limit!"); self.dep_context().sess().emit_fatal(crate::error::QueryOverflow);
} }
} }