diff options
| author | bors <bors@rust-lang.org> | 2021-02-16 02:14:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-16 02:14:13 +0000 |
| commit | 42a4673fbd40b09a99d057eaa9b3e5579b54c184 (patch) | |
| tree | 5ab393dcc74c0ab38a4cdf58f513e8eb94bb9420 /src/test/ui/pattern | |
| parent | d1206f950ffb76c76e1b74a19ae33c2b7d949454 (diff) | |
| parent | a105280a067891b557498cf9131843a75c20829a (diff) | |
Auto merge of #82153 - jonas-schievink:rollup-ls5r943, r=jonas-schievink
Rollup of 19 pull requests
Successful merges:
- #81503 (Suggest to create a new `const` item if the `fn` in the array is a `const fn`)
- #81897 (Add match pattern diagnostics regression test)
- #81975 (Seal the CommandExt, OsStrExt and OsStringExt traits)
- #82009 (const_generics: Dont evaluate array length const when handling errors)
- #82060 (Fix typos in BTreeSet::{first, last} docs)
- #82061 (CTFE validation: catch ReadPointerAsBytes and better error)
- #82063 (Fixed minor typo in catch_unwind docs)
- #82067 (const_generics: Fix incorrect ty::ParamEnv::empty() usage)
- #82077 (Edit `rustc_arena::DropArena` docs)
- #82096 (Fix a typo)
- #82106 (Remove unnecessary `Option` in `default_doc`)
- #82107 (expand: Some cleanup)
- #82118 (Add missing env!-decl variant)
- #82119 (Fix typo in link to CreateSymbolicLinkW documentation.)
- #82120 (Stabilize Arguments::as_str)
- #82129 (Remove redundant bool_to_option feature gate)
- #82133 (Update link for extern prelude.)
- #82141 (32-bit ARM: Emit `lr` instead of `r14` when specified as an `asm!` output register.)
- #82147 (:arrow_up: rust-analyzer)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/pattern')
| -rw-r--r-- | src/test/ui/pattern/usefulness/issue-72377.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/pattern/usefulness/issue-72377.stderr | 12 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/pattern/usefulness/issue-72377.rs b/src/test/ui/pattern/usefulness/issue-72377.rs new file mode 100644 index 00000000000..b0d8a53ed93 --- /dev/null +++ b/src/test/ui/pattern/usefulness/issue-72377.rs @@ -0,0 +1,17 @@ +#[derive(PartialEq, Eq)] +enum X { A, B, C, } + +fn main() { + let x = X::A; + let y = Some(X::A); + + match (x, y) { + //~^ ERROR non-exhaustive patterns: `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 + //~| more not covered + (_, None) => false, + (v, Some(w)) if v == w => true, + (X::B, Some(X::C)) => false, + (X::B, Some(X::A)) => false, + (X::A, Some(X::C)) | (X::C, Some(X::A)) => false, + }; +} diff --git a/src/test/ui/pattern/usefulness/issue-72377.stderr b/src/test/ui/pattern/usefulness/issue-72377.stderr new file mode 100644 index 00000000000..b4a68333967 --- /dev/null +++ b/src/test/ui/pattern/usefulness/issue-72377.stderr @@ -0,0 +1,12 @@ +error[E0004]: non-exhaustive patterns: `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered + --> $DIR/issue-72377.rs:8:11 + | +LL | match (x, y) { + | ^^^^^^ patterns `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more 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 `(X, Option<X>)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0004`. |
