summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
commitcec1877e180393eba0f6ddb0cf97bf3a791631c7 (patch)
tree47b4dac2a9dd9a40c30c251b4d4a72d7ccf77e9f /compiler/rustc_query_system
parentAdding debian version 1.74.1+dfsg1-1. (diff)
downloadrustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.tar.xz
rustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/Cargo.toml8
-rw-r--r--compiler/rustc_query_system/messages.ftl2
-rw-r--r--compiler/rustc_query_system/src/dep_graph/graph.rs28
-rw-r--r--compiler/rustc_query_system/src/error.rs1
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs17
5 files changed, 26 insertions, 30 deletions
diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml
index 584355df8..6ea87a4a6 100644
--- a/compiler/rustc_query_system/Cargo.toml
+++ b/compiler/rustc_query_system/Cargo.toml
@@ -3,10 +3,10 @@ name = "rustc_query_system"
version = "0.0.0"
edition = "2021"
-[lib]
-
[dependencies]
+# tidy-alphabetical-start
parking_lot = "0.12"
+rustc-rayon-core = { version = "0.5.0", optional = true }
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
@@ -15,7 +15,6 @@ rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
-rustc-rayon-core = { version = "0.5.0", optional = true }
rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
@@ -24,6 +23,9 @@ rustc_type_ir = { path = "../rustc_type_ir" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
+# tidy-alphabetical-end
[features]
+# tidy-alphabetical-start
rustc_use_parallel_compiler = ["rustc-rayon-core"]
+# tidy-alphabetical-end
diff --git a/compiler/rustc_query_system/messages.ftl b/compiler/rustc_query_system/messages.ftl
index d5fed8fe1..d7ab75575 100644
--- a/compiler/rustc_query_system/messages.ftl
+++ b/compiler/rustc_query_system/messages.ftl
@@ -15,8 +15,6 @@ query_system_cycle_stack_single = ...which immediately requires {$stack_bottom}
query_system_cycle_usage = cycle used when {$usage}
-query_system_cycle_which_requires = ...which requires {$desc}...
-
query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs
index c7e92d7b2..6cace0195 100644
--- a/compiler/rustc_query_system/src/dep_graph/graph.rs
+++ b/compiler/rustc_query_system/src/dep_graph/graph.rs
@@ -149,7 +149,6 @@ impl<D: Deps> DepGraph<D> {
DepNode { kind: D::DEP_KIND_RED, hash: Fingerprint::ZERO.into() },
EdgesVec::new(),
None,
- false,
);
assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
match red_node_prev_index_and_color {
@@ -332,7 +331,7 @@ impl<D: Deps> DepGraphData<D> {
/// - If you need 3+ arguments, use a tuple for the
/// `arg` parameter.
///
- /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/incremental-compilation.html
+ /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html
#[inline(always)]
pub fn with_task<Ctxt: HasDepContext<Deps = D>, A: Debug, R>(
&self,
@@ -373,8 +372,6 @@ impl<D: Deps> DepGraphData<D> {
let current_fingerprint =
hash_result.map(|f| dcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, &result)));
- let print_status = cfg!(debug_assertions) && dcx.sess().opts.unstable_opts.dep_tasks;
-
// Intern the new `DepNode`.
let (dep_node_index, prev_and_color) = self.current.intern_node(
dcx.profiler(),
@@ -382,7 +379,6 @@ impl<D: Deps> DepGraphData<D> {
key,
edges,
current_fingerprint,
- print_status,
);
hashing_timer.finish_with_query_invocation_id(dep_node_index.into());
@@ -589,8 +585,6 @@ impl<D: Deps> DepGraph<D> {
cx.with_stable_hashing_context(|mut hcx| hash_result(&mut hcx, result))
});
- let print_status = cfg!(debug_assertions) && cx.sess().opts.unstable_opts.dep_tasks;
-
// Intern the new `DepNode` with the dependencies up-to-now.
let (dep_node_index, prev_and_color) = data.current.intern_node(
cx.profiler(),
@@ -598,7 +592,6 @@ impl<D: Deps> DepGraph<D> {
node,
edges,
current_fingerprint,
- print_status,
);
hashing_timer.finish_with_query_invocation_id(dep_node_index.into());
@@ -1219,20 +1212,13 @@ impl<D: Deps> CurrentDepGraph<D> {
key: DepNode,
edges: EdgesVec,
fingerprint: Option<Fingerprint>,
- print_status: bool,
) -> (DepNodeIndex, Option<(SerializedDepNodeIndex, DepNodeColor)>) {
- let print_status = cfg!(debug_assertions) && print_status;
-
// Get timer for profiling `DepNode` interning
let _node_intern_timer =
self.node_intern_event_id.map(|eid| profiler.generic_activity_with_event_id(eid));
if let Some(prev_index) = prev_graph.node_to_index_opt(&key) {
- let get_dep_node_index = |color, fingerprint| {
- if print_status {
- eprintln!("[task::{color:}] {key:?}");
- }
-
+ let get_dep_node_index = |fingerprint| {
let mut prev_index_to_index = self.prev_index_to_index.lock();
let dep_node_index = match prev_index_to_index[prev_index] {
@@ -1256,12 +1242,12 @@ impl<D: Deps> CurrentDepGraph<D> {
if fingerprint == prev_graph.fingerprint_by_index(prev_index) {
// This is a green node: it existed in the previous compilation,
// its query was re-executed, and it has the same result as before.
- let dep_node_index = get_dep_node_index("green", fingerprint);
+ let dep_node_index = get_dep_node_index(fingerprint);
(dep_node_index, Some((prev_index, DepNodeColor::Green(dep_node_index))))
} else {
// This is a red node: it existed in the previous compilation, its query
// was re-executed, but it has a different result from before.
- let dep_node_index = get_dep_node_index("red", fingerprint);
+ let dep_node_index = get_dep_node_index(fingerprint);
(dep_node_index, Some((prev_index, DepNodeColor::Red)))
}
} else {
@@ -1269,14 +1255,10 @@ impl<D: Deps> CurrentDepGraph<D> {
// session, its query was re-executed, but it doesn't compute a result hash
// (i.e. it represents a `no_hash` query), so we have no way of determining
// whether or not the result was the same as before.
- let dep_node_index = get_dep_node_index("unknown", Fingerprint::ZERO);
+ let dep_node_index = get_dep_node_index(Fingerprint::ZERO);
(dep_node_index, Some((prev_index, DepNodeColor::Red)))
}
} else {
- if print_status {
- eprintln!("[task::new] {key:?}");
- }
-
let fingerprint = fingerprint.unwrap_or(Fingerprint::ZERO);
// This is a new node: it didn't exist in the previous compilation session.
diff --git a/compiler/rustc_query_system/src/error.rs b/compiler/rustc_query_system/src/error.rs
index e49e78cc7..5829e17ec 100644
--- a/compiler/rustc_query_system/src/error.rs
+++ b/compiler/rustc_query_system/src/error.rs
@@ -15,6 +15,7 @@ pub enum HandleCycleError {
Error,
Fatal,
DelayBug,
+ Stash,
}
#[derive(Subdiagnostic)]
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index ae8414ebb..1f3403d09 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -19,7 +19,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lock;
#[cfg(parallel_compiler)]
use rustc_data_structures::{outline, sync};
-use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError};
+use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError, StashKey};
use rustc_span::{Span, DUMMY_SP};
use std::cell::Cell;
use std::collections::hash_map::Entry;
@@ -133,6 +133,17 @@ where
let guar = error.delay_as_bug();
query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle, guar)
}
+ Stash => {
+ let guar = if let Some(root) = cycle_error.cycle.first()
+ && let Some(span) = root.query.span
+ {
+ error.stash(span, StashKey::Cycle);
+ qcx.dep_context().sess().delay_span_bug(span, "delayed cycle error")
+ } else {
+ error.emit()
+ };
+ query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle, guar)
+ }
}
}
@@ -459,7 +470,9 @@ where
// Similarly, fingerprint the result to assert that
// it doesn't have anything not considered hashable.
- if cfg!(debug_assertions) && let Some(hash_result) = query.hash_result() {
+ if cfg!(debug_assertions)
+ && let Some(hash_result) = query.hash_result()
+ {
qcx.dep_context().with_stable_hashing_context(|mut hcx| {
hash_result(&mut hcx, &result);
});