diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index d4217e0aa5499..b848af6eb4151 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -808,7 +808,10 @@ impl DepGraph { where F: FnOnce() -> String, { - let dep_node_debug = &self.data.as_ref().unwrap().dep_node_debug; + let Some(data) = &self.data.as_ref() else { + return; + }; + let dep_node_debug = &data.dep_node_debug; if dep_node_debug.borrow().contains_key(&dep_node) { return; diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index b8b4518b14e29..e82c1087483fa 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -307,6 +307,7 @@ impl Session { pub fn record_trimmed_def_paths(&self) { if self.opts.unstable_opts.print_type_sizes || self.opts.unstable_opts.query_dep_graph + || self.opts.unstable_opts.incremental_info || self.opts.unstable_opts.dump_mir.is_some() || self.opts.unstable_opts.unpretty.is_some() || self.opts.output_types.contains_key(&OutputType::Mir)