Skip to content

Commit b23419b

Browse files
authored
Rollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obk
normalize before handling simple checks for evaluatability of `ty::Const` `{{{{{{{ N }}}}}}}` is desugared into a `ConstKind::Unevaluated` for an anonymous `const` item so when calling `is_const_evaluatable` on it we skip the `ConstKind::Param(_) => Ok(())` arm which is incorrect.
2 parents 52cec8c + 9f438be commit b23419b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn is_const_evaluatable<'tcx>(
3030
span: Span,
3131
) -> Result<(), NotConstEvaluatable> {
3232
let tcx = infcx.tcx;
33-
match unexpanded_ct.kind() {
33+
match tcx.expand_abstract_consts(unexpanded_ct).kind() {
3434
ty::ConstKind::Unevaluated(_) | ty::ConstKind::Expr(_) => (),
3535
ty::ConstKind::Param(_)
3636
| ty::ConstKind::Bound(_, _)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
#![feature(generic_const_exprs)]
3+
#![allow(incomplete_features, unused_braces)]
4+
5+
#[rustfmt::skip]
6+
fn foo<const N: usize>() {
7+
bar::<{{{{{{ N }}}}}}>();
8+
}
9+
10+
fn bar<const N: usize>() {}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)