"using _
for array lengths is unstable" error should suggest the number of elements #100448
Closed
Description
opened on Aug 12, 2022
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fe35b2f5f585f0303661ac61e880d1fe
const NUMBERS: [i32; _] = [
1, 2, 3
];
The current output is:
error[[E0658]](https://doc.rust-lang.org/stable/error-index.html#E0658): using `_` for array lengths is unstable
--> src/lib.rs:1:22
|
1 | const NUMBERS: [i32; _] = [
| ^
|
= note: [see issue #85077 <https://github.com/rust-lang/rust/issues/85077>](https://github.com/rust-lang/rust/issues/85077) for more information
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> src/lib.rs:1:22
|
1 | const NUMBERS: [i32; _] = [
| ^ `_` not allowed here
For more information about this error, try `rustc --explain E0658`.
error: could not compile `playground` due to 2 previous errors
Ideally, the output should suggest that this should be [i32; 3].
Activity