Skip to content

Commit 6d117e7

Browse files
committed
Remove cycle_fatal query modifier
1 parent e7d90c6 commit 6d117e7

6 files changed

Lines changed: 10 additions & 46 deletions

File tree

compiler/rustc_macros/src/query.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ struct QueryModifiers {
121121
/// Cache the query to disk if the `Block` returns true.
122122
cache_on_disk_if: Option<CacheOnDiskIf>,
123123

124-
/// A cycle error for this query aborting the compilation with a fatal error.
125-
cycle_fatal: Option<Ident>,
126-
127124
/// A cycle error results in a delay_bug call
128125
cycle_delay_bug: Option<Ident>,
129126

@@ -165,7 +162,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
165162
let mut arena_cache = None;
166163
let mut cache_on_disk_if = None;
167164
let mut desc = None;
168-
let mut cycle_fatal = None;
169165
let mut cycle_delay_bug = None;
170166
let mut cycle_stash = None;
171167
let mut no_hash = None;
@@ -202,8 +198,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
202198
try_insert!(cache_on_disk_if = CacheOnDiskIf { modifier, block });
203199
} else if modifier == "arena_cache" {
204200
try_insert!(arena_cache = modifier);
205-
} else if modifier == "cycle_fatal" {
206-
try_insert!(cycle_fatal = modifier);
207201
} else if modifier == "cycle_delay_bug" {
208202
try_insert!(cycle_delay_bug = modifier);
209203
} else if modifier == "cycle_stash" {
@@ -233,7 +227,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
233227
arena_cache,
234228
cache_on_disk_if,
235229
desc,
236-
cycle_fatal,
237230
cycle_delay_bug,
238231
cycle_stash,
239232
no_hash,
@@ -350,7 +343,6 @@ fn add_to_analyzer_stream(query: &Query, analyzer_stream: &mut proc_macro2::Toke
350343

351344
doc_link!(
352345
arena_cache,
353-
cycle_fatal,
354346
cycle_delay_bug,
355347
cycle_stash,
356348
no_hash,
@@ -431,7 +423,6 @@ pub(super) fn rustc_queries(input: TokenStream) -> TokenStream {
431423

432424
passthrough!(
433425
arena_cache,
434-
cycle_fatal,
435426
cycle_delay_bug,
436427
cycle_stash,
437428
no_hash,

compiler/rustc_middle/src/queries.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
//! - `arena_cache`: Use an arena for in-memory caching of the query result.
3333
//! - `cache_on_disk_if { ... }`: Cache the query result to disk if the provided block evaluates to
3434
//! true. The query key identifier is available for use within the block, as is `tcx`.
35-
//! - `cycle_fatal`: If a dependency cycle is detected, abort compilation with a fatal error.
3635
//! - `cycle_delay_bug`: If a dependency cycle is detected, emit a delayed bug instead of aborting immediately.
3736
//! - `cycle_stash`: If a dependency cycle is detected, stash the error for later handling.
3837
//! - `no_hash`: Do not hash the query result for incremental compilation; just mark as dirty if recomputed.
@@ -149,11 +148,11 @@ use crate::{dep_graph, mir, thir};
149148
// which memoizes and does dep-graph tracking, wrapping around the actual
150149
// `Providers` that the driver creates (using several `rustc_*` crates).
151150
//
152-
// The result type of each query must implement `Clone`, and additionally
153-
// `ty::query::values::Value`, which produces an appropriate placeholder
154-
// (error) value if the query resulted in a query cycle.
155-
// Queries marked with `cycle_fatal` do not need the latter implementation,
156-
// as they will raise an fatal error on query cycles instead.
151+
// The result type of each query must implement `Clone`. Additionally
152+
// `ty::query::values::Value` can be implemented which produces an appropriate
153+
// placeholder (error) value if the query resulted in a query cycle.
154+
// Queries without a `Value` implementation will raise a fatal error on query
155+
// cycles instead.
157156
rustc_queries! {
158157
/// Caches the expansion of a derive proc macro, e.g. `#[derive(Serialize)]`.
159158
/// The key is:
@@ -587,7 +586,6 @@ rustc_queries! {
587586
}
588587

589588
query is_panic_runtime(_: CrateNum) -> bool {
590-
cycle_fatal
591589
desc { "checking if the crate is_panic_runtime" }
592590
separate_provide_extern
593591
}
@@ -1318,7 +1316,6 @@ rustc_queries! {
13181316
/// Return the set of (transitive) callees that may result in a recursive call to `key`,
13191317
/// if we were able to walk all callees.
13201318
query mir_callgraph_cyclic(key: LocalDefId) -> &'tcx Option<UnordSet<LocalDefId>> {
1321-
cycle_fatal
13221319
arena_cache
13231320
desc {
13241321
"computing (transitive) callees of `{}` that may recurse",
@@ -1329,7 +1326,6 @@ rustc_queries! {
13291326

13301327
/// Obtain all the calls into other local functions
13311328
query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1332-
cycle_fatal
13331329
desc {
13341330
"computing all local function calls in `{}`",
13351331
tcx.def_path_str(key.def_id()),
@@ -1824,31 +1820,26 @@ rustc_queries! {
18241820
}
18251821

18261822
query is_compiler_builtins(_: CrateNum) -> bool {
1827-
cycle_fatal
18281823
desc { "checking if the crate is_compiler_builtins" }
18291824
separate_provide_extern
18301825
}
18311826
query has_global_allocator(_: CrateNum) -> bool {
18321827
// This query depends on untracked global state in CStore
18331828
eval_always
1834-
cycle_fatal
18351829
desc { "checking if the crate has_global_allocator" }
18361830
separate_provide_extern
18371831
}
18381832
query has_alloc_error_handler(_: CrateNum) -> bool {
18391833
// This query depends on untracked global state in CStore
18401834
eval_always
1841-
cycle_fatal
18421835
desc { "checking if the crate has_alloc_error_handler" }
18431836
separate_provide_extern
18441837
}
18451838
query has_panic_handler(_: CrateNum) -> bool {
1846-
cycle_fatal
18471839
desc { "checking if the crate has_panic_handler" }
18481840
separate_provide_extern
18491841
}
18501842
query is_profiler_runtime(_: CrateNum) -> bool {
1851-
cycle_fatal
18521843
desc { "checking if a crate is `#![profiler_runtime]`" }
18531844
separate_provide_extern
18541845
}
@@ -1857,22 +1848,18 @@ rustc_queries! {
18571848
cache_on_disk_if { true }
18581849
}
18591850
query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1860-
cycle_fatal
18611851
desc { "getting a crate's required panic strategy" }
18621852
separate_provide_extern
18631853
}
18641854
query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1865-
cycle_fatal
18661855
desc { "getting a crate's configured panic-in-drop strategy" }
18671856
separate_provide_extern
18681857
}
18691858
query is_no_builtins(_: CrateNum) -> bool {
1870-
cycle_fatal
18711859
desc { "getting whether a crate has `#![no_builtins]`" }
18721860
separate_provide_extern
18731861
}
18741862
query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1875-
cycle_fatal
18761863
desc { "getting a crate's symbol mangling version" }
18771864
separate_provide_extern
18781865
}

compiler/rustc_middle/src/query/modifiers.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ pub(crate) struct cache_on_disk_if;
2828
/// A cycle error results in a delay_bug call
2929
pub(crate) struct cycle_delay_bug;
3030

31-
/// # `cycle_fatal` query modifier
32-
///
33-
/// A cycle error for this query aborting the compilation with a fatal error.
34-
pub(crate) struct cycle_fatal;
35-
3631
/// # `cycle_stash` query modifier
3732
///
3833
/// A cycle error results in a stashed cycle error that can be unstashed and canceled later

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub enum ActiveKeyStatus<'tcx> {
5757
#[derive(Copy, Clone)]
5858
pub enum CycleErrorHandling {
5959
Error,
60-
Fatal,
6160
DelayBug,
6261
Stash,
6362
}
@@ -656,11 +655,11 @@ macro_rules! define_callbacks {
656655
// which memoizes and does dep-graph tracking, wrapping around the actual
657656
// `Providers` that the driver creates (using several `rustc_*` crates).
658657
//
659-
// The result type of each query must implement `Clone`, and additionally
660-
// `ty::query::values::Value`, which produces an appropriate placeholder
661-
// (error) value if the query resulted in a query cycle.
662-
// Queries marked with `cycle_fatal` do not need the latter implementation,
663-
// as they will raise an fatal error on query cycles instead.
658+
// The result type of each query must implement `Clone`. Additionally
659+
// `ty::query::values::Value` can be implemented which produces an appropriate
660+
// placeholder (error) value if the query resulted in a query cycle.
661+
// Queries without a `Value` implementation will raise a fatal error on query
662+
// cycles instead.
664663

665664
mod sealed {
666665
use rustc_hir::def_id::{LocalModDefId, ModDefId};

compiler/rustc_query_impl/src/execution.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ fn handle_cycle_error<'tcx, C: QueryCache>(
140140
let guar = error.emit();
141141
query.value_from_cycle_error(tcx, cycle_error, guar)
142142
}
143-
CycleErrorHandling::Fatal => {
144-
error.emit();
145-
tcx.dcx().abort_if_errors();
146-
unreachable!()
147-
}
148143
CycleErrorHandling::DelayBug => {
149144
let guar = error.delay_as_bug();
150145
query.value_from_cycle_error(tcx, cycle_error, guar)

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ macro_rules! cycle_error_handling {
103103
([]) => {{
104104
rustc_middle::query::CycleErrorHandling::Error
105105
}};
106-
([(cycle_fatal) $($rest:tt)*]) => {{
107-
rustc_middle::query::CycleErrorHandling::Fatal
108-
}};
109106
([(cycle_stash) $($rest:tt)*]) => {{
110107
rustc_middle::query::CycleErrorHandling::Stash
111108
}};

0 commit comments

Comments
 (0)