Open
Description
Given the following code (playground):
const _SEASONS : [&str] = ["Winter", "Spring", "Summer", "Fall"];
The current output is:
error[E0277]: the size for values of type `[&'static str]` cannot be known at compilation time
--> src/lib.rs:1:18
|
1 | const _SEASONS : [&str] = ["Winter", "Spring", "Summer", "Fall"];
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[&'static str]`
Ideally the output should make it clearer why this is an error, and suggest a fix:
error: constant items must have a size known at compile-time
help: provide a length for the constant array: `[&str; 4]`
Note that if I omit the type entirely (playground):
const _SEASONS = ["Winter", "Spring", "Summer", "Fall"];
I do get an error message that suggests the correct array type:
error: missing type for `const` item
--> src/lib.rs:1:15
|
1 | const _SEASONS = ["Winter", "Spring", "Summer", "Fall"];
| ^ help: provide a type for the constant: `: [&str; 4]`