{"id":"68465d80414a9a6e","repo":"rust-lang/rust","slug":"bikeshedguaranteednodrop-is-not-const","errorCode":null,"errorMessage":"BikeshedGuaranteedNoDrop is not const","messagePattern":"BikeshedGuaranteedNoDrop is not const","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_next_trait_solver/src/solve/effect_goals.rs","lineNumber":451,"sourceCode":"                    )\n                }),\n            )?;\n            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)\n        })\n    }\n\n    fn consider_builtin_transmute_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"TransmuteFrom is not const\")\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 is not const\");\n    }\n\n    fn consider_builtin_try_as_dyn_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"`TryAsDynCompat` is not const: {:?}\", goal)\n    }\n\n    fn consider_structural_builtin_unsize_candidates(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Vec<Candidate<I>>, RerunNonErased> {\n        unreachable!(\"Unsize is not const\")\n    }\n\n    fn consider_builtin_field_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs#L433-L469","documentation":"Internal `unreachable!` in the next-gen trait solver's const-effect assembly for `BikeshedGuaranteedNoDrop` (`core::marker::BikeshedGuaranteedNoDrop`), the marker that guarantees a type's drop glue is a no-op. It is a compiler-implemented marker with no const variant, so the candidate stub `consider_builtin_bikeshed_guaranteed_no_drop_candidate` is never meant to execute. Hitting it ICEs rustc.","triggerScenarios":"The host-effect solver proves `T: const BikeshedGuaranteedNoDrop` / `~const BikeshedGuaranteedNoDrop`, e.g. by binding a const generic or `const fn` parameter to the marker, or by a `#[const_trait]` whose supertrait/implied bounds include `BikeshedGuaranteedNoDrop`.","commonSituations":"Nightly code combining `BikeshedGuaranteedNoDrop` with `const_trait_impl`; drop-analysis-driven generic const APIs; `-Znext-solver` on code that previously used the marker only at runtime; nightly regression after marker-trait effect routing changed.","solutions":["Remove the const/`~const` bound on `BikeshedGuaranteedNoDrop`; the marker has no const impl.","Audit `#[const_trait]` traits for implicit marker supertraits that synthesize the bound.","File an ICE upstream with a minimal reproducer and the `-Znext-solver` flag.","Bisect nightlies to find the routing change that exposed the branch."],"exampleFix":"// before\nconst fn hold<T: const BikeshedGuaranteedNoDrop>(_: T) {}\n\n// after\nfn hold<T: BikeshedGuaranteedNoDrop>(_: T) {}","handlingStrategy":"validation","validationCode":"// build.rs: reject const BikeshedGuaranteedNoDrop effect goals\nfn main() {\n    let src = std::fs::read_to_string(\"src/lib.rs\").unwrap_or_default();\n    for banned in [\"~const BikeshedGuaranteedNoDrop\", \"const BikeshedGuaranteedNoDrop\", \"GuaranteedNoDrop\"] {\n        assert!(!src.contains(banned), \"rejected: {banned} — no const builtin candidate\");\n    }\n    println!(\"cargo:rerun-if-changed=src/lib.rs\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["`BikeshedGuaranteedNoDrop` (the no-drop guarantee used by niche optimization / const destruct reasoning) has no const candidate (effect_goals.rs:451); do not write `T: const BikeshedGuaranteedNoDrop`.","If you need a no-drop guarantee in const code, establish it manually: constrain the type to `Copy` or wrap in `core::mem::ManuallyDrop` and document the invariant.","Avoid relying on the optimizer's drop-elision proof in const contexts; const drop reasoning only follows the `const Destruct` path.","An ICE here with no explicit bound is a solver bug — report with a minimized const-eval reproducer."],"tags":["rustc","trait-solver","const-traits","ice","marker","no-drop"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}