diff options
| author | bors <bors@rust-lang.org> | 2019-09-11 18:46:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-11 18:46:18 +0000 |
| commit | f0b58fcf03391a91f74224fe38a696d5a5b789d9 (patch) | |
| tree | fcfed11712e1af5cad16ef353352914ccfef69d5 /src/test/ui/refutable-pattern-errors.stderr | |
| parent | fe6d05a8b32f5c66c427ca524dbcce5a7145f87e (diff) | |
| parent | 20a26055b7afa500e1b00c6e5a3d03a1208c1d00 (diff) | |
| download | rust-f0b58fcf03391a91f74224fe38a696d5a5b789d9.tar.gz rust-f0b58fcf03391a91f74224fe38a696d5a5b789d9.zip | |
Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebank
check_match: refactor + improve non-exhaustive diagnostics for default binding modes
Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example:
```rust
error[E0004]: non-exhaustive patterns: `&mut &B` not covered
--> foo.rs:4:11
|
1 | enum E { A, B }
| ---------------
| | |
| | not covered
| `E` defined here
...
4 | match x {
| ^ pattern `&mut &B` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
```
Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`.
r? @estebank
Diffstat (limited to 'src/test/ui/refutable-pattern-errors.stderr')
| -rw-r--r-- | src/test/ui/refutable-pattern-errors.stderr | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/ui/refutable-pattern-errors.stderr b/src/test/ui/refutable-pattern-errors.stderr index c67ae7c6d48..3b13e25293d 100644 --- a/src/test/ui/refutable-pattern-errors.stderr +++ b/src/test/ui/refutable-pattern-errors.stderr @@ -1,14 +1,14 @@ error[E0005]: refutable pattern in function argument: `(_, _)` not covered - --> $DIR/refutable-pattern-errors.rs:1:9 + --> $DIR/refutable-pattern-errors.rs:3:9 | LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { } | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered -error[E0005]: refutable pattern in local binding: `(std::i32::MIN..=0i32, _)` not covered - --> $DIR/refutable-pattern-errors.rs:5:9 +error[E0005]: refutable pattern in local binding: `(std::i32::MIN..=0i32, _)` and `(2i32..=std::i32::MAX, _)` not covered + --> $DIR/refutable-pattern-errors.rs:7:9 | LL | let (1, (Some(1), 2..=3)) = (1, (None, 2)); - | ^^^^^^^^^^^^^^^^^^^^^ pattern `(std::i32::MIN..=0i32, _)` not covered + | ^^^^^^^^^^^^^^^^^^^^^ patterns `(std::i32::MIN..=0i32, _)` and `(2i32..=std::i32::MAX, _)` not covered error: aborting due to 2 previous errors |
