E0077
Digit outside the literal's base
ErrorA hexadecimal literal uses the digits 0-9, a-f and A-F, a binary literal uses 0 and 1, and an octal literal uses 0-7. Any other letter or digit after the prefix is an error, reported at that character.
Why
A digit that the base does not have has no value there. 0b102 would be a typo for a binary number, or a decimal number written with the wrong prefix, and the compiler cannot tell which.
Broken
fn main() {
let n = 0xFG
print(n)
}
What sisu says
error[E0077]: `G` is not a hexadecimal digit --> E0077.sisu:2:16 | 2 | let n = 0xFG | ^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0077
Fixed
fn main() {
let n = 0xFF
print(n)
}
Related
- E0008: a
_outside digits.
Sisu