{"id":"0ae502b324aa3264","repo":"rust-lang/rust","slug":"pointee-is-not-const","errorCode":null,"errorMessage":"Pointee is not const","messagePattern":"Pointee is not const","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_next_trait_solver/src/solve/effect_goals.rs","lineNumber":371,"sourceCode":"    fn consider_builtin_async_fn_kind_helper_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"AsyncFnKindHelper is not const\")\n    }\n\n    fn consider_builtin_tuple_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"Tuple trait is not const\")\n    }\n\n    fn consider_builtin_pointee_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"Pointee is not const\")\n    }\n\n    fn consider_builtin_future_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unreachable!(\"Future is not const\")\n    }\n\n    fn consider_builtin_iterator_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution))\n    }\n\n    fn consider_builtin_fused_iterator_candidate(\n        _ecx: &mut EvalCtxt<'_, D>,","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs#L353-L389","documentation":"`consider_builtin_pointee_candidate` (effect_goals.rs:371) is `unreachable!`. The `Pointee` built-in trait (used to derive the metadata/pointee type for `std::ptr::Pointee`) has no const counterpart — querying `T: const Pointee` is logically invalid. Reaching this branch indicates the host-effect goal assembly produced a goal that should have been filtered out earlier.","triggerScenarios":"Reached when the next solver evaluates a `HostEffectPredicate` for the `Pointee` trait (lang item) with a const effect and falls into the built-in pointee candidate branch (effect_goals.rs:367).","commonSituations":"Nightly with `const_trait_impl`/`host_effects` combined with custom DSTs / `std::ptr::Pointee` usage; solver refactor that no longer short-circuits unsatisfiable host-effect goals; goal emitted via a derive or generic bound.","solutions":["Remove any const/host-effect bound that could force a `const Pointee` obligation.","Disable `-Znext-solver` and `const_trait_impl` to confirm the source.","Reduce and report the ICE; upgrade nightly.","Avoid `Pointee`-dependent generic code inside `const fn` boundaries."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pointee (the trait behind `core::ptr::Pointee`) is not const. Do not request a Pointee\n// metadata computation (e.g. slice/dyn metadata) inside a const obligation.\nconst fn reject_pointee_in_const<T: ?Sized>(_t: &T) {} // ICE if next solver evaluates Pointee","typeGuard":"// Narrow to sized types so Pointee metadata is trivial and never solved in const.\nfn sized_only<T: Sized>(_t: &T) {}","tryCatchPattern":null,"preventionTips":["Avoid `core::ptr::Pointee` / `Pointee::Metadata` lookups in `const fn` or const generics; the trait is non-const.","For unsized types in const code, compute metadata via concrete intrinsic (e.g. `slice.len()`) rather than the Pointee trait.","Bound const generic params with `T: Sized` to keep the solver away from Pointee entirely."],"tags":["rustc-ice","const-traits","host-effects","pointee","dst","nightly","compiler-internal"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}