Open
Description
The following code:
fn uwu<const N: usize>() {
let _ = [0; N{}];
}
produces the error
error: generic parameters may not be used in const operations
--> src/lib.rs:2:17
|
2 | let _ = [0; N{}];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
however, when enabling feature(generic_const_exprs)
, the error changes to
error[[E0574]](https://doc.rust-lang.org/nightly/error_codes/E0574.html): expected struct, variant or union type, found const parameter `N`
--> src/lib.rs:4:17
|
4 | let _ = [0; N{}];
| ^ not a struct, variant or union type
The error on stable should change to be the same as the error with generic_const_exprs
enabled.
On stable, it's probably more likely that the user doesn't want the generic to be const, or wants to remove the {}
than them trying to actually do anything with generic_const_exprs
.