{"record":{"id":"10bed4a573810103","repo":"rust-lang/rust","slug":"processing-delegation","errorCode":null,"errorMessage":"processing delegation","messagePattern":"processing delegation","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_middle/src/hir/map.rs","lineNumber":872,"sourceCode":"    }\n\n    pub fn hir_expect_expr(self, id: HirId) -> &'tcx Expr<'tcx> {\n        match self.hir_node(id) {\n            Node::Expr(expr) => expr,\n            _ => bug!(\"expected expr, found {}\", self.hir_id_to_string(id)),\n        }\n    }\n\n    pub fn hir_opt_delegation_sig_id(self, def_id: LocalDefId) -> Option<DefId> {\n        self.opt_hir_owner_node(def_id)?.fn_decl()?.opt_delegation_sig_id()\n    }\n\n    pub fn hir_opt_delegation_info(self, def_id: LocalDefId) -> Option<&'tcx DelegationInfo> {\n        self.opt_hir_owner_node(def_id)?.fn_decl()?.opt_delegation_info()\n    }\n\n    pub fn hir_delegation_info(self, delegation_id: LocalDefId) -> &'tcx DelegationInfo {\n        self.hir_opt_delegation_info(delegation_id).expect(\"processing delegation\")\n    }\n\n    #[inline]\n    fn hir_opt_ident(self, id: HirId) -> Option<Ident> {\n        match self.hir_node(id) {\n            Node::Pat(&Pat { kind: PatKind::Binding(_, _, ident, _), .. }) => Some(ident),\n            // A `Ctor` doesn't have an identifier itself, but its parent\n            // struct/variant does. Compare with `hir::Map::span`.\n            Node::Ctor(..) => match self.parent_hir_node(id) {\n                Node::Item(item) => Some(item.kind.ident().unwrap()),\n                Node::Variant(variant) => Some(variant.ident),\n                _ => unreachable!(),\n            },\n            node => node.ident(),\n        }\n    }\n\n    #[inline]","sourceCodeStart":854,"sourceCodeEnd":890,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_middle/src/hir/map.rs#L854-L890","documentation":"Fires in `hir_delegation_info` (hir/map.rs:872). The method expects the HIR node for `delegation_id` to be a function whose `fn_decl` carries `DelegationInfo` (the data for a `reuse`/delegation item); `.expect(\"processing delegation\")` panics when `opt_delegation_info` returns `None`. It is an internal invariant: the query is only supposed to be called on actual delegation items (the `DelegationInfo` arena entry in hir.rs).","triggerScenarios":"The delegation-processing query (`delegation_fn_sig`, `delegation_user_specified_args`, etc. in rustc_hir_analysis/src/delegation.rs) is invoked on a `LocalDefId` whose HIR node is not a delegation function, or whose `FnDecl` did not get `DelegationInfo` attached during lowering. An internal rustc bug in the (still-gated) delegation/reuse feature.","commonSituations":"Using the unstable delegation feature (`#![feature(delegation)]` / `reuse`) on a nightly where lowering has a bug; a recent HIR refactor that stopped attaching `DelegationInfo`; mixing nightly versions while reusing `target/`.","solutions":["`cargo clean` and rebuild to rule out stale HIR/metadata caches.","Try a different nightly (the delegation feature is evolving; the bug may be fixed or reverted upstream).","Reduce the delegation usage to the minimal `reuse Path;` / `reuse fn` form to see if a specific pattern triggers it.","Reproduces on a clean, current nightly -> file an ICE against the delegation feature with the minimal reproducer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# The delegation feature is nightly-gated; confirm the toolchain and\n# reduce usage to a minimal reproducer.\nrustc +nightly --version\ncargo clean && cargo +nightly build","typeGuard":null,"tryCatchPattern":"cargo +nightly build || { cargo clean && cargo +nightly build; }","preventionTips":["Pin a specific nightly via `rust-toolchain.toml` since the delegation feature is still evolving.","`cargo clean` after switching nightlies when using `#![feature(delegation)]`.","Reduce delegation usage (`reuse`) to the minimal form to isolate the triggering pattern before reporting.","Track the delegation feature's tracking issue for known-lowerering bugs."],"tags":["hir","delegation","ice","nightly-feature"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}