diff options
| author | bors <bors@rust-lang.org> | 2020-07-05 23:08:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-05 23:08:08 +0000 |
| commit | 0c03aee8b81185d65b5821518661c30ecdb42de5 (patch) | |
| tree | 5d9ea2c252f737710f1a071b08babc537c90ca2c /src/test/ui/pattern | |
| parent | 2753fab7ce3647033146b07c8b6c9f4856a910b0 (diff) | |
| parent | e62436333eb4c3d98c23f1a0478e35a843cc4b95 (diff) | |
Auto merge of #74073 - Manishearth:rollup-faqo9lx, r=Manishearth
Rollup of 12 pull requests
Successful merges:
- #72688 (added .collect() into String from Box<str>)
- #73787 (Add unstable docs for rustc_attrs)
- #73834 (Some refactoring around intrinsic type checking)
- #73871 (Fix try_print_visible_def_path for Rust 2018)
- #73937 (Explain exhaustive matching on {usize,isize} maximum values)
- #73973 (Use `Span`s to identify unreachable subpatterns in or-patterns)
- #74000 (add `lazy_normalization_consts` feature gate)
- #74025 (Remove unnecessary release from Arc::try_unwrap)
- #74027 (Convert more `DefId`s to `LocalDefId`s)
- #74055 (Fix spacing in Iterator fold doc)
- #74057 (expected_found `&T` -> `T`)
- #74064 (variant_count: avoid incorrect dummy implementation)
Failed merges:
r? @ghost
Diffstat (limited to 'src/test/ui/pattern')
| -rw-r--r-- | src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.rs | 23 | ||||
| -rw-r--r-- | src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.stderr | 34 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.rs b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.rs new file mode 100644 index 00000000000..0c52876e21f --- /dev/null +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.rs @@ -0,0 +1,23 @@ +use std::{usize, isize}; + +fn main() { + match 0usize { + //~^ ERROR non-exhaustive patterns + //~| NOTE pattern `_` not covered + //~| NOTE the matched value is of type `usize` + //~| 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` + //~| NOTE `isize` does not have a fixed maximum value + isize::MIN ..= isize::MAX => {} + } + + match 7usize {} + //~^ ERROR non-exhaustive patterns + //~| NOTE the matched value is of type `usize` +} diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.stderr new file mode 100644 index 00000000000..d0aa452fd38 --- /dev/null +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-pointer-size-int.stderr @@ -0,0 +1,34 @@ +error[E0004]: non-exhaustive patterns: `_` not covered + --> $DIR/non-exhaustive-pattern-pointer-size-int.rs:4:11 + | +LL | match 0usize { + | ^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `usize` + = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively + = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching + +error[E0004]: non-exhaustive patterns: `_` not covered + --> $DIR/non-exhaustive-pattern-pointer-size-int.rs:12:11 + | +LL | match 0isize { + | ^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `isize` + = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively + = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching + +error[E0004]: non-exhaustive patterns: type `usize` is non-empty + --> $DIR/non-exhaustive-pattern-pointer-size-int.rs:20:11 + | +LL | match 7usize {} + | ^^^^^^ + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `usize` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0004`. |
