1 error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered
2 --> $DIR/issue-31561.rs:8:9
4 LL | let Thing::Foo(y) = Thing::Foo(1);
5 | ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered
7 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
9 note: `Thing` defined here
10 --> $DIR/issue-31561.rs:3:5
19 = note: the matched value is of type `Thing`
20 help: you might want to use `if let` to ignore the variants that aren't matched
22 LL | let y = if let Thing::Foo(y) = Thing::Foo(1) { y } else { todo!() };
23 | ++++++++++ ++++++++++++++++++++++
24 help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variants that aren't matched
26 LL | let Thing::Foo(y) = Thing::Foo(1) else { todo!() };
29 error: aborting due to previous error
31 For more information about this error, try `rustc --explain E0005`.