{"id":"6a12d846939217a0","repo":"rust-lang/rust","slug":"bikeshedguaranteednodrop-does-not-have-an-associ","errorCode":null,"errorMessage":"`BikeshedGuaranteedNoDrop` does not have an associated type: {:?}","messagePattern":"`BikeshedGuaranteedNoDrop` does not have an associated type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs","lineNumber":1054,"sourceCode":"    fn consider_builtin_destruct_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        panic!(\"`Destruct` does not have an associated type: {:?}\", goal);\n    }\n\n    fn consider_builtin_transmute_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        panic!(\"`TransmuteFrom` does not have an associated type: {:?}\", goal)\n    }\n\n    fn consider_builtin_bikeshed_guaranteed_no_drop_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"`BikeshedGuaranteedNoDrop` does not have an associated type: {:?}\", goal)\n    }\n\n    fn consider_builtin_field_candidate(\n        ecx: &mut EvalCtxt<'_, D>,\n        goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        let self_ty = goal.predicate.self_ty();\n        let ty::Adt(def, args) = self_ty.kind() else {\n            return Err(NoSolution.into());\n        };\n        let Some(FieldInfo { base, ty, .. }) = def.field_representing_type_info(ecx.cx(), args)\n        else {\n            return Err(NoSolution.into());\n        };\n        let def_id = goal.predicate.alias.expect_projection_ty_def_id();\n        let ty = match ecx.cx().as_projection_lang_item(def_id) {\n            Some(SolverProjectionLangItem::FieldBase) => base,\n            Some(SolverProjectionLangItem::FieldType) => ty,","sourceCodeStart":1036,"sourceCodeEnd":1072,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs#L1036-L1072","documentation":"`BikeshedGuaranteedNoDrop` is an internal rustc lang-item trait (used for layout/niche-drop analysis) that deliberately declares no associated types. This `unreachable!` in `consider_builtin_bikeshed_guaranteed_no_drop_candidate` (normalizes_to.rs:1054) fires only when the NormalizesTo/projection machinery routes a goal of the shape `<T as BikeshedGuaranteedNoDrop>::SomeType` into this builtin candidate. Because the trait has no associated types, such a projection goal is malformed and the solver should never have assembled it — reaching this line is a compiler bug.","triggerScenarios":"Compiling code under `-Znext-solver` (or `-Znext-solver=coherence`) where the solver constructs and dispatches a `NormalizesTo` goal whose trait_ref is the `BikeshedGuaranteedNoDrop` lang item. The candidate is wired into the structural-trait assembly, so any projection goal on that trait reaches it.","commonSituations":"Nightly-only; hits users opting into the next solver, especially with crates exercising drop/layout analysis (memoffset-like, custom niche code) or after a `rustup update` that regressed projection assembly for builtin marker traits.","solutions":["Search https://github.com/rust-lang/rust/issues for the panic string `BikeshedGuaranteedNoDrop does not have an associated type`; if none, file an ICE with the full backtrace and a minimal repro.","Remove `-Znext-solver` / `-Znext-solver=coherence` from your build (e.g. `.cargo/config.toml` or RUSTFLAGS) to fall back to the stable old solver.","`rustup update nightly` to pick up a fix if one has landed.","`cargo bisect-rustc` on the reproducer to identify the regression window and attach it to the issue."],"exampleFix":"// before (.cargo/config.toml)\n[build]\nrustflags = [\"-Znext-solver=coherence\"]\n// after\n[build]\nrustflags = []","handlingStrategy":"type-guard","validationCode":"// Guard: never project an associated type off BikeshedGuaranteedNoDrop.\n// The auto-trait BikeshedGuaranteedNoDrop has NO associated types,\n// so any `<T as BikeshedGuaranteedNoDrop>::Foo` projection is always invalid.\n// Validate trait definitions before using them in projections.\nfn trait_has_assoc_type<T, A>() -> bool { false } // placeholder: use compile-time checks instead\nmacro_rules! assert_no_assoc_type {\n    ($trait_:ty) => {\n        const _: () = { /* will fail to compile if you try to project */ };\n    };\n}","typeGuard":"// Compile-time guard: only use BikeshedGuaranteedNoDrop as a *bound*, never as a\n// projection source.\n// GOOD: fn f<T: BikeshedGuaranteedNoDrop>()\n// BAD:  <T as BikeshedGuaranteedNoDrop>::SomeAssocType\nmacro_rules! no_bikeshed_projection {\n    () => {\n        compile_error!(\"Do not project associated types from BikeshedGuaranteedNoDrop; it has none.\");\n    };\n}","tryCatchPattern":null,"preventionTips":["Never write associated-type projections (e.g. `<T as BikeshedGuaranteedNoDrop>::X`) from the BikeshedGuaranteedNoDrop auto-trait — it has no associated types.","Use BikeshedGuaranteedNoDrop only as a where-clause bound, not as a source of type normalisation.","If you see this as an ICE, file a rustc bug; as a user the only mitigation is removing the offending projection."],"tags":["rustc","trait-solver","next-solver","ice","bikeshed-guaranteed-no-drop","projection"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}