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/iterators/iter-sum-overflow-overflow-checks.rs | |
| 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/iterators/iter-sum-overflow-overflow-checks.rs')
0 files changed, 0 insertions, 0 deletions
