|
| 1 | +error[E0005]: refutable pattern in local binding |
| 2 | + --> $DIR/suggest-with-let-issue-145548.rs:6:5 |
| 3 | + | |
| 4 | +LL | Some(x) = Some(1); |
| 5 | + | ^^^^^^^ pattern `None` not covered |
| 6 | + | |
| 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/ch19-02-refutability.html |
| 9 | + = note: the matched value is of type `Option<i32>` |
| 10 | +help: you might want to use `let else` to handle the variant that isn't matched |
| 11 | + | |
| 12 | +LL | Some(x) = Some(1) else { todo!() }; |
| 13 | + | ++++++++++++++++ |
| 14 | + |
| 15 | +error[E0005]: refutable pattern in local binding |
| 16 | + --> $DIR/suggest-with-let-issue-145548.rs:11:9 |
| 17 | + | |
| 18 | +LL | let Some(x) = Some(1); |
| 19 | + | ^^^^^^^ pattern `None` not covered |
| 20 | + | |
| 21 | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant |
| 22 | + = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html |
| 23 | + = note: the matched value is of type `Option<i32>` |
| 24 | +help: you might want to use `let else` to handle the variant that isn't matched |
| 25 | + | |
| 26 | +LL | let Some(x) = Some(1) else { todo!() }; |
| 27 | + | ++++++++++++++++ |
| 28 | + |
| 29 | +error[E0005]: refutable pattern in local binding |
| 30 | + --> $DIR/suggest-with-let-issue-145548.rs:15:5 |
| 31 | + | |
| 32 | +LL | Some(()) = Some(()); |
| 33 | + | ^^^^^^^^ pattern `None` not covered |
| 34 | + | |
| 35 | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant |
| 36 | + = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html |
| 37 | + = note: the matched value is of type `Option<()>` |
| 38 | +help: you might want to use `if let` to ignore the variant that isn't matched |
| 39 | + | |
| 40 | +LL | if Some(()) = Some(()) { todo!() }; |
| 41 | + | ++ +++++++++++ |
| 42 | + |
| 43 | +error: aborting due to 3 previous errors |
| 44 | + |
| 45 | +For more information about this error, try `rustc --explain E0005`. |
0 commit comments