Closed
Description
When playing around in the playground, I found an error message that was kind of strange for the situation:
fn main() {
[(); loop { break; } ]
}
The error message is as follow:
Compiling playground v0.0.1 (file:///playground)
error[E0308]: mismatched types
--> src/main.rs:2:17
|
2 | [(); loop { break; } ]
| ^^^^^ expected (), found usize
|
= note: expected type `()`
found type `usize`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
playground link: https://play.rust-lang.org/?gist=c6caaee68d6886fce7e3f0af324f5338&version=nightly&mode=debug
The error message would make more sense if described as Expected usize, found ()
, or just not permit loop {}
constructs at all at the place of the length of an array.