{"id":"0f44b502973e9e9c","repo":"rust-lang/rust","slug":"transmutefrom-does-not-have-an-associated-type","errorCode":null,"errorMessage":"`TransmuteFrom` does not have an associated type: {:?}","messagePattern":"`TransmuteFrom` 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":1047,"sourceCode":"\n        ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {\n            ecx.instantiate_normalizes_to_term(goal, discriminant_ty.into())?;\n            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)\n        })\n    }\n\n    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)","sourceCodeStart":1029,"sourceCodeEnd":1065,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs#L1029-L1065","documentation":"consider_builtin_transmute_candidate (normalizes_to.rs:1047) panics unconditionally. The TransmuteFrom trait (core::mem::TransmuteFrom, the safe-transmute foundation) has no associated types — it answers a yes/no trait question. Trait goals are handled in trait_goals.rs; if a NormalizesTo (projection) goal for TransmuteFrom reaches this stub, the solver has constructed an impossible projection against an associated-type-less trait.","triggerScenarios":"A NormalizesTo goal whose trait_ref is the TransmuteTrait lang item reaches the next-solver builtin-candidate assembly. Because TransmuteFrom has no associated items, no valid surface code can produce such a projection; it indicates a goal-kind misclassification or malformed projection inside the solver.","commonSituations":"Experimenting with the `safe_transmute` / TransmuteFrom nightly feature under -Znext-solver on a regressed toolchain; fuzzing; not triggered by normal transmute/mem::transmute usage.","solutions":["Update to the latest nightly (rustup update nightly).","Disable -Znext-solver (remove the flag or -Znext-solver=no) to use the legacy solver.","File an ICE at https://github.com/rust-lang/rust/issues with the goal printed in the panic and a minimal reproducer.","Bisect nightlies to locate the introducing commit and include it in the report."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// `TransmuteFrom` (nightly) is a bool-like trait with NO associated types.\n// Use it only as a bound: `T: TransmuteFrom<U, const ASSUME: bool>`.\nfn safe_transmute<S, D>() where D: core::mem::TransmuteFrom<S, false> {} // OK\n","typeGuard":"trait _GuardTransmute<S, D: core::mem::TransmuteFrom<S, false>> {} // bound-only sentinel\n","tryCatchPattern":null,"preventionTips":["Never project associated types off `TransmuteFrom`; it has none.","Always pass the const `ASSUME` argument explicitly (prefer `false`).","Prefer `bytemuck::Pod` / `zerocopy` over hand-rolled transmute trait reasoning.","Pin nightly toolchain; transmute trait semantics change frequently."],"tags":["rust","rustc","trait-solver","next-solver","ice","panic","builtin-impl","transmute","associated-type"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}