Sisu
E0040

Integer literal too large for u8

Error

Built from the repository at commit a8614dc.

A number written in a place that expects a u8 must be between 0 and 255.

Why

A u8 is one byte. A literal that does not fit would have to lose bits to become one, and Sisu does not do that silently.

Broken

fn main() {
    let b: u8 = 300
    print(b)
}

What sisu says

error[E0040]: `300` does not fit in `u8`
 --> E0040.sisu:2:17
  |
2 |     let b: u8 = 300
  |                 ^^^

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0040

Fixed

fn main() {
    let b: u8 = 200
    print(b)
}

Related

  • E0009: an integer literal too large for i64.