{"id":"86fba4276e208fa5","repo":"rust-lang/rust","slug":"asyncfnkindhelper-is-not-const","errorCode":null,"errorMessage":"AsyncFnKindHelper is not const","messagePattern":"AsyncFnKindHelper is not const","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_next_trait_solver/src/solve/effect_goals.rs","lineNumber":357,"sourceCode":"            pred,\n            requirements,\n        )\n        .map_err(Into::into)\n    }\n\n    fn consider_builtin_async_fn_trait_candidates(\n        _ecx: &mut EvalCtxt<'_, D>,\n        _goal: Goal<I, Self>,\n        _kind: rustc_type_ir::ClosureKind,\n    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {\n        unimplemented!(\"AsyncFn* are not yet const\")\n    }\n\n    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>,","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs#L339-L375","documentation":"`consider_builtin_async_fn_kind_helper_candidate` (effect_goals.rs:357) is `unreachable!`. `AsyncFnKindHelper` is an internal lang item used during async-fn by-move vs by-ref analysis; it is a purely runtime/type-system helper with no meaningful const semantics. Reaching this branch means a `const AsyncFnKindHelper` goal was assembled, which is logically impossible by construction — a compiler bug in goal routing.","triggerScenarios":"Reached when the next solver assembles a `HostEffectPredicate` whose trait is `AsyncFnKindHelper` (lang item) and reaches the built-in candidate branch (effect_goals.rs:353). This should never happen for well-formed input.","commonSituations":"Nightly with `const_trait_impl`/`host_effects` combined with async-closure features (`async_closure`, `async_fn_in_trait`); miscompilation or goal-routing regression after a solver change.","solutions":["Confirm `const_trait_impl`/`-Znext-solver`/async-closure features are responsible by toggling them off.","Reduce the async-closure + const interaction to a minimal case and file an ICE report.","Bisect the toolchain with `cargo bisect-rustc` to locate the regression.","Avoid `const` bounds on code paths that involve async closures until the feature stabilizes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// AsyncFnKindHelper is an internal, non-const lang trait. Never let it appear in a const obligation.\n// Reviewer check: any `async fn` in generic position whose kind must be inferred is a risk.\nfn no_async_kind_helper_in_const<T>(_t: &T) where T: Sized /* not : AsyncFnKindHelper */ {}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid generic `async fn` signatures (where the compiler must solve AsyncFnKindHelper) inside crates that also use const generics or const fn.","Prefer concrete `async fn` definitions over generic ones when the next trait solver is enabled.","Keep the next solver disabled for crates mixing async-fn-kind inference with const contexts."],"tags":["rustc-ice","const-traits","host-effects","async-closures","nightly","compiler-internal"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}