{"id":"1f8097280f112591","repo":"rust-lang/rust","slug":"cannot-summarize-when-dependencies-are-not-recorde","errorCode":null,"errorMessage":"Cannot summarize when dependencies are not recorded.","messagePattern":"Cannot summarize when dependencies are not recorded\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_middle/src/dep_graph/graph.rs","lineNumber":652,"sourceCode":"                        );\n                    }\n\n                    return dep_node_index;\n                }\n            }\n\n            // `read_deps` calls the closure exactly once, with the current task's deps.\n            let mut reads = SmallVec::<[DepNodeIndex; SMALL_READS_MAX]>::new();\n            read_deps(|task_deps| match task_deps {\n                TaskDepsRef::Allow(deps) => {\n                    reads = SmallVec::from_slice(deps.lock().edges());\n                }\n                TaskDepsRef::EvalAlways => {\n                    reads.push(DepNodeIndex::FOREVER_RED_NODE);\n                }\n                TaskDepsRef::Ignore => {}\n                TaskDepsRef::Forbid => {\n                    panic!(\"Cannot summarize when dependencies are not recorded.\")\n                }\n            });\n\n            data.hash_result_and_alloc_node(tcx, node, &reads, result, hash_result)\n        } else {\n            // Incremental compilation is turned off. We just execute the task\n            // without tracking. We still provide a dep-node index that uniquely\n            // identifies the task so that we have a cheap way of referring to\n            // the query for self-profiling.\n            self.next_virtual_depnode_index()\n        }\n    }\n}\n\nimpl DepGraphData {\n    fn assert_dep_node_not_yet_allocated_in_current_session<S: std::fmt::Display>(\n        &self,\n        sess: &Session,","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_middle/src/dep_graph/graph.rs#L634-L670","documentation":"In `with_task` (graph.rs:652), after running a query the dep graph summarizes the task's recorded reads to allocate a dep node. The read-deps closure must handle every `TaskDepsRef` variant; `Forbid` means dependencies were explicitly disallowed for this task, so summarization is impossible and the compiler panics rather than silently dropping the node.","triggerScenarios":"An internal rustc invariant breach: a query ran under `TaskDepsRef::Forbid` (no dep recording allowed) yet execution reached the dep-node allocation path that requires summarizing reads. This indicates a bug in how a query's TaskDeps was configured versus the context it actually ran in.","commonSituations":"Developing/modifying rustc query plumbing; extremely rare in normal builds. Not triggered by user source code or configuration.","solutions":["If you hit this as an end user, treat it as an internal compiler bug: capture the ICE note and file a rustc issue with the repro.","As a workaround, disable incremental compilation for the failing build (`CARGO_INCREMENTAL=0` or `-Zincremental=no`).","If developing rustc, audit the query's TaskDeps assignment — a `Forbid` task should not reach the summarization/alloc path."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Summarization requires that dependency edges were recorded; check first.\nfn can_summarize(g: &DepGraph) -> Result<(), String> {\n    if g.dep_edges_recorded() {\n        Ok(())\n    } else {\n        Err(\"Cannot summarize when dependencies are not recorded.\".into())\n    }\n}","typeGuard":"fn deps_recorded(g: &DepGraph) -> bool {\n    g.dep_edges_recorded()\n}","tryCatchPattern":null,"preventionTips":["Only call summarize/serialize on a dep-graph built with dependency recording enabled (e.g. not in the 'no-dep-graph' or anonymous query mode).","Confirm the compilation mode actually populates the dep graph before consuming it; release/no-dep builds skip recording.","Do not reuse a graph handle after disabling recording for a sub-task."],"tags":["rustc","dep-graph","internal","incremental"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}