2020-10-05 16:23:36 +00:00
|
|
|
error[E0600]: cannot apply unary operator `-` to type `usize`
|
|
|
|
--> $DIR/unsigned-literal-negation.rs:2:13
|
|
|
|
|
|
|
|
|
LL | let x = -1 as usize;
|
2024-07-05 00:52:01 +00:00
|
|
|
| ^^ cannot apply unary operator `-`
|
2020-10-05 16:23:36 +00:00
|
|
|
|
|
|
|
|
= note: unsigned values cannot be negated
|
2024-07-05 00:52:01 +00:00
|
|
|
help: you may have meant the maximum value of `usize`
|
|
|
|
|
|
|
|
|
LL | let x = usize::MAX;
|
|
|
|
| ~~~~~~~~~~
|
2020-10-05 16:23:36 +00:00
|
|
|
|
|
|
|
error[E0600]: cannot apply unary operator `-` to type `usize`
|
|
|
|
--> $DIR/unsigned-literal-negation.rs:3:13
|
|
|
|
|
|
|
|
|
LL | let x = (-1) as usize;
|
2024-07-05 00:52:01 +00:00
|
|
|
| ^^^^ cannot apply unary operator `-`
|
2020-10-05 16:23:36 +00:00
|
|
|
|
|
|
|
|
= note: unsigned values cannot be negated
|
2024-07-05 00:52:01 +00:00
|
|
|
help: you may have meant the maximum value of `usize`
|
|
|
|
|
|
|
|
|
LL | let x = usize::MAX;
|
|
|
|
| ~~~~~~~~~~
|
2020-10-05 16:23:36 +00:00
|
|
|
|
|
|
|
error[E0600]: cannot apply unary operator `-` to type `u32`
|
|
|
|
--> $DIR/unsigned-literal-negation.rs:4:18
|
|
|
|
|
|
|
|
|
LL | let x: u32 = -1;
|
2024-07-05 00:52:01 +00:00
|
|
|
| ^^ cannot apply unary operator `-`
|
2020-10-05 16:23:36 +00:00
|
|
|
|
|
|
|
|
= note: unsigned values cannot be negated
|
2024-07-05 00:52:01 +00:00
|
|
|
help: you may have meant the maximum value of `u32`
|
|
|
|
|
|
|
|
|
LL | let x: u32 = u32::MAX;
|
|
|
|
| ~~~~~~~~
|
2020-10-05 16:23:36 +00:00
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0600`.
|