Skip to content

Fix ICE when dumping the dep graph with the parallel frontend - #160063

Open
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:fix/parallel-dump-dep-graph-ice
Open

Fix ICE when dumping the dep graph with the parallel frontend#160063
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:fix/parallel-dump-dep-graph-ice

Conversation

@xmakro

@xmakro xmakro commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

-Zquery-dep-graph -Zdump-dep-graph ICEs whenever -Zthreads is greater than 1:

$ echo 'fn main() {}' > foo.rs
$ rustc -C incremental=incr -Zquery-dep-graph -Zdump-dep-graph -Zthreads=2 foo.rs
thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/retained.rs:40:63:
called `Option::unwrap()` on a `None` value

Reproduces on nightly on 15 of 15 runs at -Zthreads 2, 4 and 8. -Zthreads=1 passes.

Dep-graph indices are handed to threads in batches of 256 and EncoderState::finish abandons each worker's unused tail, so LinkedGraph::add_node_with_idx back-fills the skipped slots with data: None. RetainedDepGraph::nodes unwrapped every slot, instead we skip the empty ones.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 28, 2026
@xmakro

xmakro commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

r? @petrochenkov
who has context on this from #152621

@xmakro
xmakro marked this pull request as ready for review July 28, 2026 11:57
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 28, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2b2b925 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 28, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
…-ice, r=petrochenkov

Fix ICE when dumping the dep graph with the parallel frontend

`-Zquery-dep-graph -Zdump-dep-graph` ICEs whenever `-Zthreads` is greater than 1:

```console
$ echo 'fn main() {}' > foo.rs
$ rustc -C incremental=incr -Zquery-dep-graph -Zdump-dep-graph -Zthreads=2 foo.rs
thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/retained.rs:40:63:
called `Option::unwrap()` on a `None` value
```

Reproduces on nightly on 15 of 15 runs at `-Zthreads` 2, 4 and 8. `-Zthreads=1` passes.

Dep-graph indices are handed to threads in batches of 256 and `EncoderState::finish` abandons each worker's unused tail, so `LinkedGraph::add_node_with_idx` back-fills the skipped slots with `data: None`. `RetainedDepGraph::nodes` unwrapped every slot, instead we skip the empty ones.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
…-ice, r=petrochenkov

Fix ICE when dumping the dep graph with the parallel frontend

`-Zquery-dep-graph -Zdump-dep-graph` ICEs whenever `-Zthreads` is greater than 1:

```console
$ echo 'fn main() {}' > foo.rs
$ rustc -C incremental=incr -Zquery-dep-graph -Zdump-dep-graph -Zthreads=2 foo.rs
thread 'rustc' panicked at compiler/rustc_middle/src/dep_graph/retained.rs:40:63:
called `Option::unwrap()` on a `None` value
```

Reproduces on nightly on 15 of 15 runs at `-Zthreads` 2, 4 and 8. `-Zthreads=1` passes.

Dep-graph indices are handed to threads in batches of 256 and `EncoderState::finish` abandons each worker's unused tail, so `LinkedGraph::add_node_with_idx` back-fills the skipped slots with `data: None`. `RetainedDepGraph::nodes` unwrapped every slot, instead we skip the empty ones.
rust-bors Bot pushed a commit that referenced this pull request Jul 28, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #159990 (Many "predicate"-to-"clause" renamings)
 - #159665 (Replace most `Ty::new_fn_def` calls with `type_of` queries directly)
 - #159687 (rustdoc: Set tracing max_level_info when debug-logging is false)
 - #160057 (refactor(mir-transform): Calculate optimization status inside `run_passes_inner`)
 - #160060 (codegen: skip stores for entirely-uninit constant aggregate fields, attempt #2)
 - #160063 (Fix ICE when dumping the dep graph with the parallel frontend)
 - #160065 (Distinguish the dep-graph index space from the live node count)
 - #158038 (Split register_tool into register_attribute_tool and register_lint_tool)
 - #159776 (remove const hack in alloc)
 - #159978 (run intrinsic-test by default on x86_64-gnu)
 - #160008 (Avoid stale closure recovery state across statements)
 - #160027 (Add regression test for #132767)
 - #160030 (Update `browser-ui-test` version to `0.25.0`)
 - #160046 (Improve consistency of attribute error messages (part 2))
 - #160056 (Fix associated function suggestion for generic ADTs)
 - #160069 (Update Rust crate tracing-subscriber to v0.3.23 [SECURITY])
 - #160071 (sanitize_standard_fds: clarify macos comment)
 - #160076 (use unstable features when updating dependencies)
 - #160092 (miri ui tests: don't run native tests on stage 0)
 - #160093 (Switch cargo assignments to weihanglo)
 - #160094 (Update assignment for docs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants