Skip to content

Commit 0431857

Browse files
authored
Rollup merge of #58365 - Zoxc:task-status, r=michaelwoerister
Add an option to print the status of incremental tasks / dep nodes after running them r? @michaelwoerister
2 parents 975cdb5 + f0b15f6 commit 0431857

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/librustc/dep_graph/graph.rs

+15
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,28 @@ impl DepGraph {
292292
task_deps.map(|lock| lock.into_inner()),
293293
);
294294

295+
let print_status = cfg!(debug_assertions) && hcx.sess().opts.debugging_opts.dep_tasks;
296+
295297
// Determine the color of the new DepNode.
296298
if let Some(prev_index) = data.previous.node_to_index_opt(&key) {
297299
let prev_fingerprint = data.previous.fingerprint_by_index(prev_index);
298300

299301
let color = if let Some(current_fingerprint) = current_fingerprint {
300302
if current_fingerprint == prev_fingerprint {
303+
if print_status {
304+
eprintln!("[task::green] {:?}", key);
305+
}
301306
DepNodeColor::Green(dep_node_index)
302307
} else {
308+
if print_status {
309+
eprintln!("[task::red] {:?}", key);
310+
}
303311
DepNodeColor::Red
304312
}
305313
} else {
314+
if print_status {
315+
eprintln!("[task::unknown] {:?}", key);
316+
}
306317
// Mark the node as Red if we can't hash the result
307318
DepNodeColor::Red
308319
};
@@ -312,6 +323,10 @@ impl DepGraph {
312323
insertion for {:?}", key);
313324

314325
data.colors.insert(prev_index, color);
326+
} else {
327+
if print_status {
328+
eprintln!("[task::new] {:?}", key);
329+
}
315330
}
316331

317332
(result, dep_node_index)

src/librustc/session/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12371237
"show extended diagnostic help"),
12381238
continue_parse_after_error: bool = (false, parse_bool, [TRACKED],
12391239
"attempt to recover from parse errors (experimental)"),
1240+
dep_tasks: bool = (false, parse_bool, [UNTRACKED],
1241+
"print tasks that execute and the color their dep node gets (requires debug build)"),
12401242
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
12411243
"enable incremental compilation (experimental)"),
12421244
incremental_queries: bool = (true, parse_bool, [UNTRACKED],

0 commit comments

Comments
 (0)