]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/usefulness/issue-31561.stderr
Rollup merge of #80298 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomez
[rust.git] / src / test / ui / pattern / usefulness / issue-31561.stderr
1 error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered
2   --> $DIR/issue-31561.rs:8:9
3    |
4 LL | / enum Thing {
5 LL | |     Foo(u8),
6 LL | |     Bar,
7    | |     --- not covered
8 LL | |     Baz
9    | |     --- not covered
10 LL | | }
11    | |_- `Thing` defined here
12 ...
13 LL |       let Thing::Foo(y) = Thing::Foo(1);
14    |           ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered
15    |
16    = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
17    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
18    = note: the matched value is of type `Thing`
19 help: you might want to use `if let` to ignore the variant that isn't matched
20    |
21 LL |     if let Thing::Foo(y) = Thing::Foo(1) { /* */ }
22    |
23
24 error: aborting due to previous error
25
26 For more information about this error, try `rustc --explain E0005`.