Skip to content

Commit

Permalink
Unrolled build for rust-lang#116534
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#116534 - cjgillot:no-dep-tasks, r=davidtwco

Remove -Zdep-tasks.

This option is not useful any more, we can use `tracing` and `RUSTC_LOG` to debug the dep-graph.
  • Loading branch information
rust-timer authored Oct 28, 2023
2 parents 17659c7 + 8531ebf commit c609e26
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 28 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ fn test_unstable_options_tracking_hash() {
// tidy-alphabetical-start
untracked!(assert_incr_state, Some(String::from("loaded")));
untracked!(deduplicate_diagnostics, false);
untracked!(dep_tasks, true);
untracked!(dont_buffer_diagnostics, true);
untracked!(dump_dep_graph, true);
untracked!(dump_mir, Some(String::from("abc")));
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_query_impl/src/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,6 @@ where
);

if let Some(key) = Q::Key::recover(tcx, &dep_node) {
#[cfg(debug_assertions)]
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
force_query(query, QueryCtxt::new(tcx), key, dep_node);
true
} else {
Expand Down
26 changes: 4 additions & 22 deletions compiler/rustc_query_system/src/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -373,16 +372,13 @@ 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(),
&self.previous,
key,
edges,
current_fingerprint,
print_status,
);

hashing_timer.finish_with_query_invocation_id(dep_node_index.into());
Expand Down Expand Up @@ -589,16 +585,13 @@ 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(),
&data.previous,
node,
edges,
current_fingerprint,
print_status,
);

hashing_timer.finish_with_query_invocation_id(dep_node_index.into());
Expand Down Expand Up @@ -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] {
Expand All @@ -1256,27 +1242,23 @@ 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 {
// This is a red node, effectively: it existed in the previous compilation
// 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.
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,6 @@ options! {
dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
"in dep-info output, omit targets for tracking dependencies of the dep-info files \
themselves (default: no)"),
dep_tasks: bool = (false, parse_bool, [UNTRACKED],
"print tasks that execute and the color their dep node gets (requires debug build) \
(default: no)"),
dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED],
"emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \
(default: no)"),
Expand Down

0 comments on commit c609e26

Please sign in to comment.