Exhaustive integer matching
Exhaustive integer matching was stabilised in Rust 1.33.0. The original example in the question now works (updated to use the modern syntax for ranges).
fn main() {
for i in std::u8::MIN..=std::u8::MAX {
match i {
0x00..=0xff => {}
}
}
}
As discussed in the referenced issue, Rust's exhaustiveness checking is based entirely on enums and never values, so this fails because u8
simply isn't an enum type.