File tree Expand file tree Collapse file tree
compiler/rustc_middle/src/dep_graph Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -826,7 +826,13 @@ impl DepGraph {
826826 where
827827 F : FnOnce ( ) -> String ,
828828 {
829- let dep_node_debug = & self . data . as_ref ( ) . unwrap ( ) . dep_node_debug ;
829+ // Early queries (e.g., `-Z query-dep-graph` on empty crates) can reach here
830+ // before the graph is initialized. Return early to prevent an ICE.
831+ let data = match & self . data {
832+ Some ( d) => d,
833+ None => return ,
834+ } ;
835+ let dep_node_debug = & data. dep_node_debug ;
830836
831837 if dep_node_debug. borrow ( ) . contains_key ( & dep_node) {
832838 return ;
Original file line number Diff line number Diff line change 1+ //@ build-pass
2+ //@ compile-flags: -Zquery-dep-graph --crate-type lib
3+ //@ edition: 2021
4+
5+ // This file is intentionally left empty to reproduce issue #153199.
6+ // rustc used to ICE when generating a dependency graph for an empty file
7+ // because of a duplicate DepNode registration hitting a debug_assert.
You can’t perform that action at this time.
0 commit comments