rust/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.rs

24 lines
677 B
Rust
Raw Normal View History

use std::{usize, isize};
fn main() {
match 0usize {
//~^ ERROR non-exhaustive patterns
//~| NOTE pattern `_` not covered
//~| NOTE the matched value is of type `usize`
2020-07-04 18:40:59 +00:00
//~| NOTE `usize` does not have a fixed maximum value
0 ..= usize::MAX => {}
}
match 0isize {
//~^ ERROR non-exhaustive patterns
//~| NOTE pattern `_` not covered
//~| NOTE the matched value is of type `isize`
2020-07-04 18:40:59 +00:00
//~| NOTE `isize` does not have a fixed maximum value
isize::MIN ..= isize::MAX => {}
}
2020-07-04 18:40:59 +00:00
match 7usize {}
//~^ ERROR non-exhaustive patterns
//~| NOTE the matched value is of type `usize`
}