Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ struct QueryModifiers {
/// Cache the query to disk if the `Block` returns true.
cache_on_disk_if: Option<CacheOnDiskIf>,

/// A cycle error for this query aborting the compilation with a fatal error.
cycle_fatal: Option<Ident>,

/// A cycle error results in a delay_bug call
cycle_delay_bug: Option<Ident>,

Expand Down Expand Up @@ -165,7 +162,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
let mut arena_cache = None;
let mut cache_on_disk_if = None;
let mut desc = None;
let mut cycle_fatal = None;
let mut cycle_delay_bug = None;
let mut cycle_stash = None;
let mut no_hash = None;
Expand Down Expand Up @@ -202,8 +198,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
try_insert!(cache_on_disk_if = CacheOnDiskIf { modifier, block });
} else if modifier == "arena_cache" {
try_insert!(arena_cache = modifier);
} else if modifier == "cycle_fatal" {
try_insert!(cycle_fatal = modifier);
} else if modifier == "cycle_delay_bug" {
try_insert!(cycle_delay_bug = modifier);
} else if modifier == "cycle_stash" {
Expand Down Expand Up @@ -233,7 +227,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
arena_cache,
cache_on_disk_if,
desc,
cycle_fatal,
cycle_delay_bug,
cycle_stash,
no_hash,
Expand Down Expand Up @@ -350,7 +343,6 @@ fn add_to_analyzer_stream(query: &Query, analyzer_stream: &mut proc_macro2::Toke

doc_link!(
arena_cache,
cycle_fatal,
cycle_delay_bug,
cycle_stash,
no_hash,
Expand Down Expand Up @@ -431,7 +423,6 @@ pub(super) fn rustc_queries(input: TokenStream) -> TokenStream {

passthrough!(
arena_cache,
cycle_fatal,
cycle_delay_bug,
cycle_stash,
no_hash,
Expand Down
23 changes: 5 additions & 18 deletions compiler/rustc_middle/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
//! - `arena_cache`: Use an arena for in-memory caching of the query result.
//! - `cache_on_disk_if { ... }`: Cache the query result to disk if the provided block evaluates to
//! true. The query key identifier is available for use within the block, as is `tcx`.
//! - `cycle_fatal`: If a dependency cycle is detected, abort compilation with a fatal error.
//! - `cycle_delay_bug`: If a dependency cycle is detected, emit a delayed bug instead of aborting immediately.
//! - `cycle_stash`: If a dependency cycle is detected, stash the error for later handling.
//! - `no_hash`: Do not hash the query result for incremental compilation; just mark as dirty if recomputed.
Expand Down Expand Up @@ -149,11 +148,11 @@ use crate::{dep_graph, mir, thir};
// which memoizes and does dep-graph tracking, wrapping around the actual
// `Providers` that the driver creates (using several `rustc_*` crates).
//
// The result type of each query must implement `Clone`, and additionally
// `ty::query::values::Value`, which produces an appropriate placeholder
// (error) value if the query resulted in a query cycle.
// Queries marked with `cycle_fatal` do not need the latter implementation,
// as they will raise an fatal error on query cycles instead.
// The result type of each query must implement `Clone`. Additionally
// `ty::query::values::Value` can be implemented which produces an appropriate
// placeholder (error) value if the query resulted in a query cycle.
// Queries without a `Value` implementation will raise a fatal error on query
// cycles instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this will need updating because values::Value is being renamed from_cycle_error::FromCycleError.

rustc_queries! {
/// Caches the expansion of a derive proc macro, e.g. `#[derive(Serialize)]`.
/// The key is:
Expand Down Expand Up @@ -587,7 +586,6 @@ rustc_queries! {
}

query is_panic_runtime(_: CrateNum) -> bool {
cycle_fatal
desc { "checking if the crate is_panic_runtime" }
separate_provide_extern
}
Expand Down Expand Up @@ -1318,7 +1316,6 @@ rustc_queries! {
/// Return the set of (transitive) callees that may result in a recursive call to `key`,
/// if we were able to walk all callees.
query mir_callgraph_cyclic(key: LocalDefId) -> &'tcx Option<UnordSet<LocalDefId>> {
cycle_fatal
arena_cache
desc {
"computing (transitive) callees of `{}` that may recurse",
Expand All @@ -1329,7 +1326,6 @@ rustc_queries! {

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

query is_compiler_builtins(_: CrateNum) -> bool {
cycle_fatal
desc { "checking if the crate is_compiler_builtins" }
separate_provide_extern
}
query has_global_allocator(_: CrateNum) -> bool {
// This query depends on untracked global state in CStore
eval_always
cycle_fatal
desc { "checking if the crate has_global_allocator" }
separate_provide_extern
}
query has_alloc_error_handler(_: CrateNum) -> bool {
// This query depends on untracked global state in CStore
eval_always
cycle_fatal
desc { "checking if the crate has_alloc_error_handler" }
separate_provide_extern
}
query has_panic_handler(_: CrateNum) -> bool {
cycle_fatal
desc { "checking if the crate has_panic_handler" }
separate_provide_extern
}
query is_profiler_runtime(_: CrateNum) -> bool {
cycle_fatal
desc { "checking if a crate is `#![profiler_runtime]`" }
separate_provide_extern
}
Expand All @@ -1857,22 +1848,18 @@ rustc_queries! {
cache_on_disk_if { true }
}
query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
cycle_fatal
desc { "getting a crate's required panic strategy" }
separate_provide_extern
}
query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
cycle_fatal
desc { "getting a crate's configured panic-in-drop strategy" }
separate_provide_extern
}
query is_no_builtins(_: CrateNum) -> bool {
cycle_fatal
desc { "getting whether a crate has `#![no_builtins]`" }
separate_provide_extern
}
query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion {
cycle_fatal
desc { "getting a crate's symbol mangling version" }
separate_provide_extern
}
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_middle/src/query/modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ pub(crate) struct cache_on_disk_if;
/// A cycle error results in a delay_bug call
pub(crate) struct cycle_delay_bug;

/// # `cycle_fatal` query modifier
///
/// A cycle error for this query aborting the compilation with a fatal error.
pub(crate) struct cycle_fatal;

/// # `cycle_stash` query modifier
///
/// A cycle error results in a stashed cycle error that can be unstashed and canceled later
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_middle/src/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub enum ActiveKeyStatus<'tcx> {
#[derive(Copy, Clone)]
pub enum CycleErrorHandling {
Error,
Fatal,
DelayBug,
Stash,
}
Expand Down Expand Up @@ -656,11 +655,11 @@ macro_rules! define_callbacks {
// which memoizes and does dep-graph tracking, wrapping around the actual
// `Providers` that the driver creates (using several `rustc_*` crates).
//
// The result type of each query must implement `Clone`, and additionally
// `ty::query::values::Value`, which produces an appropriate placeholder
// (error) value if the query resulted in a query cycle.
// Queries marked with `cycle_fatal` do not need the latter implementation,
// as they will raise an fatal error on query cycles instead.
// The result type of each query must implement `Clone`. Additionally
// `ty::query::values::Value` can be implemented which produces an appropriate
// placeholder (error) value if the query resulted in a query cycle.
// Queries without a `Value` implementation will raise a fatal error on query
// cycles instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#153169 removes this comment.


mod sealed {
use rustc_hir::def_id::{LocalModDefId, ModDefId};
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_query_impl/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ fn handle_cycle_error<'tcx, C: QueryCache>(
let guar = error.emit();
query.value_from_cycle_error(tcx, cycle_error, guar)
}
CycleErrorHandling::Fatal => {
error.emit();
tcx.dcx().abort_if_errors();
unreachable!()
}
CycleErrorHandling::DelayBug => {
let guar = error.delay_as_bug();
query.value_from_cycle_error(tcx, cycle_error, guar)
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_query_impl/src/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ macro_rules! cycle_error_handling {
([]) => {{
rustc_middle::query::CycleErrorHandling::Error
}};
([(cycle_fatal) $($rest:tt)*]) => {{
rustc_middle::query::CycleErrorHandling::Fatal
}};
([(cycle_stash) $($rest:tt)*]) => {{
rustc_middle::query::CycleErrorHandling::Stash
}};
Expand Down
Loading