{"record":{"id":"44b20fd2c442912d","repo":"rust-lang/rust","slug":"feature-generic-const-exprs-is-not-supported-in","errorCode":null,"errorMessage":"`feature(generic_const_exprs)` is not supported in the new trait solver","messagePattern":"`feature\\(generic_const_exprs\\)` is not supported in the new trait solver","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_next_trait_solver/src/solve/mod.rs","lineNumber":269,"sourceCode":"\n        let ct_ty = match ct.kind() {\n            ty::ConstKind::Infer(_) => {\n                return self\n                    .evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)\n                    .map_err(Into::into);\n            }\n            ty::ConstKind::Error(_) => {\n                return self\n                    .evaluate_added_goals_and_make_canonical_response(Certainty::Yes)\n                    .map_err(Into::into);\n            }\n            ty::ConstKind::Alias(ty::IsRigid::Yes, alias_const) => {\n                alias_const.type_of(self.cx()).skip_norm_wip()\n            }\n            ty::ConstKind::Alias(ty::IsRigid::No, _) => unimplemented!(\n                \"non-rigid unevaluated constant for compute_const_arg_has_type_goal: {ct:?}\"\n            ),\n            ty::ConstKind::Expr(_) => unimplemented!(\n                \"`feature(generic_const_exprs)` is not supported in the new trait solver\"\n            ),\n            ty::ConstKind::Param(_) => {\n                unreachable!(\"`ConstKind::Param` should have been canonicalized to `Placeholder`\")\n            }\n            ty::ConstKind::Bound(_, _) => panic!(\"escaping bound vars in {:?}\", ct),\n            ty::ConstKind::Value(cv) => cv.ty(),\n            ty::ConstKind::Placeholder(placeholder) => {\n                placeholder.find_const_ty_from_env(goal.param_env)\n            }\n        };\n\n        self.eq(goal.param_env, ct_ty, ty)?;\n        self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes).map_err(Into::into)\n    }\n}\n\n#[derive(Debug)]","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_next_trait_solver/src/solve/mod.rs#L251-L287","documentation":"An `unimplemented!(\"\\`feature(generic_const_exprs)\\` is not supported in the new trait solver\")` ICE in the next trait solver. When a const argument is a `ConstKind::Expr` (an unexpanded const expression, the representation the `generic_const_exprs` feature produces), the new solver explicitly refuses it because that feature is incompatible with the new solver and panics at mod.rs:269.","triggerScenarios":"Enabling both `-Znext-solver` and `#![feature(generic_const_exprs)]` in the same crate, so that a const generic argument is represented as `ConstKind::Expr` and reaches `compute_const_arg_has_type_goal`.","commonSituations":"Nightly crates that use generic const expressions (`[u8; N + 1]` in generics) and are then compiled with the next solver enabled (globally or via a downstream crate). The two are explicitly unsupported together.","solutions":["Do not combine `-Znext-solver` with `#![feature(generic_const_exprs)]`; pick one.","Remove `generic_const_exprs` and use concrete const values or const generics that do not require expression evaluation.","Track upstream; the new solver may eventually support `generic_const_exprs`, but currently it is a hard incompatibility."],"exampleFix":"// before (next solver + generic_const_exprs -> ICE)\n#![feature(generic_const_exprs)]\nfn f<const N: usize>() -> [u8; N + 1] { [0; N + 1] }\n// compiled with: -Znext-solver\n\n// after — drop the feature, or drop -Znext-solver\nfn f<const N: usize>() -> [u8; N] { [0; N] }","handlingStrategy":"validation","validationCode":"# Hard-incompatibility check: feature(generic_const_exprs) + next-solver\nif rg -q 'feature(generic_const_exprs)' src/ && [[ \"${RUSTFLAGS:-}\" == *next-solver* ]]; then\n  echo \"FATAL: feature(generic_const_exprs) is not supported with -Znext-solver\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine `#![feature(generic_const_exprs)]` with `-Znext-solver`.","Add a CI guard that fails when both are set together.","Replace `[T; N + 1]`-style const expressions with concrete consts when migrating to the next solver."],"tags":["rustc","next-solver","const-generics","generic-const-exprs","nightly","ice","compiler-internal","feature-incompatibility"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}