E0042
Error
u8 that is negated
ErrorA u8 cannot be negative, so unary - does not apply to one.
Why
Negating a u8 has no u8 result, and Sisu does not pick another type for you. Convert it to an i64 first, and negate that.
Broken
fn main() {
let b: u8 = 5
let n = -b
print(n)
}
What sisu says
error[E0042]: `u8` cannot be negative --> E0042.sisu:3:13 | 3 | let n = -b | ^^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0042
Fixed
fn main() {
let b: u8 = 5
let n = -i64(b)
print(n)
}
Sisu