Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7ce59eb

Browse files
committedAug 31, 2022
SessionDiagnostic for QueryOverflow error
1 parent 166aef9 commit 7ce59eb

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed
 

‎compiler/rustc_error_messages/locales/en-US/query_system.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ query_system_cycle_recursive_ty_alias_help2 = see <https://doc.rust-lang.org/ref
2121
query_system_cycle_recursive_trait_alias = trait aliases cannot be recursive
2222
2323
query_system_cycle_which_requires = ...which requires {$desc}...
24+
25+
query_system_query_overflow = queries overflow the depth limit!

‎compiler/rustc_error_messages/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ fluent_messages! {
4848
passes => "../locales/en-US/passes.ftl",
4949
plugin_impl => "../locales/en-US/plugin_impl.ftl",
5050
privacy => "../locales/en-US/privacy.ftl",
51+
query_system => "../locales/en-US/query_system.ftl",
5152
save_analysis => "../locales/en-US/save_analysis.ftl",
5253
ty_utils => "../locales/en-US/ty_utils.ftl",
5354
typeck => "../locales/en-US/typeck.ftl",
5455
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
55-
query_system => "../locales/en-US/query_system.ftl",
5656
}
5757

5858
pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};

‎compiler/rustc_query_system/src/error.rs

+4
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ pub struct IncrementCompilation {
6767
pub run_cmd: String,
6868
pub dep_node: String,
6969
}
70+
71+
#[derive(SessionDiagnostic)]
72+
#[diag(query_system::query_overflow)]
73+
pub struct QueryOverflow;

‎compiler/rustc_query_system/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,6 @@ pub trait QueryContext: HasDepContext {
125125
) -> R;
126126

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

0 commit comments

Comments
 (0)
Please sign in to comment.