{"record":{"id":"dad17b5fc54551c7","repo":"rust-lang/rust","slug":"must-contain-self-type-as-selfty-propagation-kin","errorCode":null,"errorMessage":"must contain self type as `SelfTy` propagation kind is specified","messagePattern":"must contain self type as `SelfTy` propagation kind is specified","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_ast_lowering/src/delegation/mod.rs","lineNumber":425,"sourceCode":"                            None => hir::Ty { kind, hir_id: self.next_id(), span },\n                        };\n\n                        Some(&*self.arena.alloc(ty))\n                    }\n                    _ => ty,\n                };\n\n                hir::QPath::Resolved(ty, self.arena.alloc(new_path))\n            }\n            hir::QPath::TypeRelative(..) => unreachable!(\"until inherent methods are supported\"),\n        };\n\n        if let Some(hir::DelegationSelfTyPropagationKind::SelfTy(id)) =\n            generics.self_ty_propagation_kind.as_mut()\n        {\n            *id = match new_path {\n                hir::QPath::Resolved(ty, _) => {\n                    ty.expect(\"must contain self type as `SelfTy` propagation kind is specified\")\n                }\n                hir::QPath::TypeRelative(ty, _) => ty,\n            }\n            .hir_id;\n        }\n\n        let callee_path = self.arena.alloc(self.mk_expr(hir::ExprKind::Path(new_path), span));\n        let args = self.arena.alloc_from_iter(args);\n        let call = self.mk_expr(hir::ExprKind::Call(callee_path, args), span);\n\n        let expr = if res.sig_mapping.map_return {\n            let res = Res::SelfTyAlias {\n                alias_to: res.parent.to_def_id(),\n                is_trait_impl: self.tcx.def_kind(res.parent) == DefKind::Impl { of_trait: true },\n            };\n\n            let ident = Ident::new(kw::SelfUpper, span);\n            let path = self.create_resolved_qpath(res, ident, span);","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_ast_lowering/src/delegation/mod.rs#L407-L443","documentation":"delegation/mod.rs:425: when self_ty_propagation_kind is SelfTy(id) and the lowered callee path is a QPath::Resolved(ty, _), the code expects ty to be Some via .expect(\"must contain self type as `SelfTy` propagation kind is specified\"). The invariant: a propagation kind of SelfTy is only set when a self type was attached to the resolved path.","triggerScenarios":"Delegation lowering sets DelegationSelfTyPropagationKind::SelfTy on a resolved QPath whose type slot is None, an internal inconsistency in the delegation path lowering.","commonSituations":"Unstable fn-delegation code paths; a compiler bug where the propagation kind and the attached self type disagree.","solutions":["File a rustc ICE with the minimized delegation repro.","Avoid delegation contexts that trigger SelfTy propagation (e.g. trait-impl delegation with return mapping).","Try an alternate nightly and bisect.","Simplify the delegation callee path to a plain inherent method."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat as an ICE in unstable delegation; report with a minimized repro.","Avoid delegation forms that trigger SelfTy propagation until the feature stabilizes.","Bisect across nightlies and pin to a working toolchain.","Simplify the delegation callee to a plain inherent method."],"tags":["rust","delegation","compiler-internal","ice"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}