Skip to content

Commit c72b1a1

Browse files
Rollup merge of rust-lang#153276 - Zoxc:rem-fatal-cycle, r=nnethercote
Remove `cycle_fatal` query modifier This removes the `cycle_fatal` query modifier as it has no effect on its current users. The default `CycleErrorHandling::Error` mode does the same as `cycle_fatal` when the default impl of `FromCycleError` is used. The return types of queries using `cycle_fatal` however have no specialized `FromCycleError` impl.
2 parents 7b3fdc0 + 91c7627 commit c72b1a1

File tree

5 files changed

+4
-36
lines changed

5 files changed

+4
-36
lines changed

compiler/rustc_macros/src/query.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ struct QueryModifiers {
144144
arena_cache: Option<Ident>,
145145
cache_on_disk_if: Option<CacheOnDiskIf>,
146146
cycle_delay_bug: Option<Ident>,
147-
cycle_fatal: Option<Ident>,
148147
cycle_stash: Option<Ident>,
149148
depth_limit: Option<Ident>,
150149
desc: Desc,
@@ -160,7 +159,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
160159
let mut arena_cache = None;
161160
let mut cache_on_disk_if = None;
162161
let mut desc = None;
163-
let mut cycle_fatal = None;
164162
let mut cycle_delay_bug = None;
165163
let mut cycle_stash = None;
166164
let mut no_hash = None;
@@ -197,8 +195,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
197195
try_insert!(cache_on_disk_if = CacheOnDiskIf { modifier, block });
198196
} else if modifier == "arena_cache" {
199197
try_insert!(arena_cache = modifier);
200-
} else if modifier == "cycle_fatal" {
201-
try_insert!(cycle_fatal = modifier);
202198
} else if modifier == "cycle_delay_bug" {
203199
try_insert!(cycle_delay_bug = modifier);
204200
} else if modifier == "cycle_stash" {
@@ -228,7 +224,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
228224
arena_cache,
229225
cache_on_disk_if,
230226
desc,
231-
cycle_fatal,
232227
cycle_delay_bug,
233228
cycle_stash,
234229
no_hash,
@@ -248,7 +243,6 @@ fn make_modifiers_stream(query: &Query, modifiers: &QueryModifiers) -> proc_macr
248243
arena_cache,
249244
cache_on_disk_if,
250245
cycle_delay_bug,
251-
cycle_fatal,
252246
cycle_stash,
253247
depth_limit,
254248
desc: _,
@@ -266,8 +260,6 @@ fn make_modifiers_stream(query: &Query, modifiers: &QueryModifiers) -> proc_macr
266260

267261
let cycle_error_handling = if cycle_delay_bug.is_some() {
268262
quote! { DelayBug }
269-
} else if cycle_fatal.is_some() {
270-
quote! { Fatal }
271263
} else if cycle_stash.is_some() {
272264
quote! { Stash }
273265
} else {
@@ -407,7 +399,6 @@ fn add_to_analyzer_stream(query: &Query, analyzer_stream: &mut proc_macro2::Toke
407399

408400
doc_link!(
409401
arena_cache,
410-
cycle_fatal,
411402
cycle_delay_bug,
412403
cycle_stash,
413404
no_hash,

compiler/rustc_middle/src/queries.rs

Lines changed: 4 additions & 17 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::from_cycle_error::FromCycleError`, which produces an appropriate
151+
// The result type of each query must implement `Clone`. Additionally
152+
// `ty::query::from_cycle_error::FromCycleError` can be implemented which produces an appropriate
154153
// placeholder (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 a fatal error on query cycles instead.
154+
// Queries without a `FromCycleError` 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
}
@@ -1323,7 +1321,6 @@ rustc_queries! {
13231321
/// Return the set of (transitive) callees that may result in a recursive call to `key`,
13241322
/// if we were able to walk all callees.
13251323
query mir_callgraph_cyclic(key: LocalDefId) -> &'tcx Option<UnordSet<LocalDefId>> {
1326-
cycle_fatal
13271324
arena_cache
13281325
desc {
13291326
"computing (transitive) callees of `{}` that may recurse",
@@ -1334,7 +1331,6 @@ rustc_queries! {
13341331

13351332
/// Obtain all the calls into other local functions
13361333
query mir_inliner_callees(key: ty::InstanceKind<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
1337-
cycle_fatal
13381334
desc {
13391335
"computing all local function calls in `{}`",
13401336
tcx.def_path_str(key.def_id()),
@@ -1829,31 +1825,26 @@ rustc_queries! {
18291825
}
18301826

18311827
query is_compiler_builtins(_: CrateNum) -> bool {
1832-
cycle_fatal
18331828
desc { "checking if the crate is_compiler_builtins" }
18341829
separate_provide_extern
18351830
}
18361831
query has_global_allocator(_: CrateNum) -> bool {
18371832
// This query depends on untracked global state in CStore
18381833
eval_always
1839-
cycle_fatal
18401834
desc { "checking if the crate has_global_allocator" }
18411835
separate_provide_extern
18421836
}
18431837
query has_alloc_error_handler(_: CrateNum) -> bool {
18441838
// This query depends on untracked global state in CStore
18451839
eval_always
1846-
cycle_fatal
18471840
desc { "checking if the crate has_alloc_error_handler" }
18481841
separate_provide_extern
18491842
}
18501843
query has_panic_handler(_: CrateNum) -> bool {
1851-
cycle_fatal
18521844
desc { "checking if the crate has_panic_handler" }
18531845
separate_provide_extern
18541846
}
18551847
query is_profiler_runtime(_: CrateNum) -> bool {
1856-
cycle_fatal
18571848
desc { "checking if a crate is `#![profiler_runtime]`" }
18581849
separate_provide_extern
18591850
}
@@ -1862,22 +1853,18 @@ rustc_queries! {
18621853
cache_on_disk_if { true }
18631854
}
18641855
query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
1865-
cycle_fatal
18661856
desc { "getting a crate's required panic strategy" }
18671857
separate_provide_extern
18681858
}
18691859
query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
1870-
cycle_fatal
18711860
desc { "getting a crate's configured panic-in-drop strategy" }
18721861
separate_provide_extern
18731862
}
18741863
query is_no_builtins(_: CrateNum) -> bool {
1875-
cycle_fatal
18761864
desc { "getting whether a crate has `#![no_builtins]`" }
18771865
separate_provide_extern
18781866
}
18791867
query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
1880-
cycle_fatal
18811868
desc { "getting a crate's symbol mangling version" }
18821869
separate_provide_extern
18831870
}

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: 0 additions & 1 deletion
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
}

compiler/rustc_query_impl/src/execution.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ fn mk_cycle<'tcx, C: QueryCache>(
131131
let guar = error.emit();
132132
query.value_from_cycle_error(tcx, cycle_error, guar)
133133
}
134-
CycleErrorHandling::Fatal => {
135-
let guar = error.emit();
136-
guar.raise_fatal();
137-
}
138134
CycleErrorHandling::DelayBug => {
139135
let guar = error.delay_as_bug();
140136
query.value_from_cycle_error(tcx, cycle_error, guar)

0 commit comments

Comments
 (0)