Closed
Description
Another of those little enhancement suggestions. This code:
fn main() {
let x: u32 = -1;
}
With rustc 1.48.0-nightly gives this error message:
error[E0600]: cannot apply unary operator `-` to type `u32`
--> ...\temp.rs:2:18
|
2 | let x: u32 = -1;
| ^^ cannot apply unary operator `-`
|
= note: unsigned values cannot be negated
I suggest to modify the note, to suggest that u32::MAX may be desired instead, because in C code often you see people use -1 to get the max unsigned value.