{"record":{"id":"83dad5ee68fe2893","repo":"rust-lang/rust","slug":"asyncfn-are-not-yet-const","errorCode":null,"errorMessage":"AsyncFn* are not yet const","messagePattern":"AsyncFn\\* are not yet const","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_next_trait_solver/src/solve/effect_goals.rs","lineNumber":350,"sourceCode":"        ))\n        .to_host_effect_clause(cx, goal.predicate.constness);\n\n        Self::probe_and_consider_implied_clause(\n            ecx,\n            CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),\n            goal,\n            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>,","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs#L332-L368","documentation":"An `unimplemented!(\"AsyncFn* are not yet const\")` ICE in the next trait solver (`consider_builtin_async_fn_trait_candidates`). When the new solver must build a candidate proving an async-callable type (async closure / async fn / async fn pointer) satisfies a const `AsyncFn`/`AsyncFnMut`/`AsyncFnOnce` obligation, the candidate is unimplemented and panics at effect_goals.rs:350.","triggerScenarios":"Enabling `-Znext-solver` and requiring const `AsyncFn*` — e.g. calling an async closure in a `const` context that the new solver must discharge.","commonSituations":"Nightly + `-Znext-solver` + experimental const async-closure usage. Not reachable on stable.","solutions":["Do not enable `-Znext-solver` when using const async-closure patterns.","Move the async-closure call out of const context (use it at runtime).","Track upstream const-`AsyncFn*` support in the next solver."],"exampleFix":"// before (next solver + const async closure call -> ICE)\nconst fn run(f: async || -> i32) -> ... { f() }\n// compiled with: -Znext-solver\n\n// after — runtime call, no -Znext-solver\nfn run(f: impl async Fn() -> i32) -> impl Future<Output = i32> { async { f().await } }","handlingStrategy":"fallback","validationCode":"# Detect next-solver + const async closure calls\nif [[ \"${RUSTFLAGS:-}\" == *next-solver* ]]; then\n  rg -nE 'async \\|\\||const fn .*AsyncFn' src/ && echo \"avoid: const AsyncFn* unsupported in the next solver\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not enable `-Znext-solver` when using const async-closure patterns.","Move async-closure calls to runtime code.","Track const-`AsyncFn*` support upstream."],"tags":["rustc","next-solver","const-eval","async-fn-traits","nightly","ice","compiler-internal","unfinished-feature"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}