You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust suggests adding else to non-let assignment. #145548
error[E0005]: refutable pattern inlocal binding
--> src/main.rs:3:5
|
3 | Some(x) = Some(1);| ^^^^^^^ pattern `None` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
= note: the matched value is of type`Option<i32>`
help: you might want to use `let else` to handle the variant that isn't matched |3 | Some(x) = Some(1) else { todo!() }; | ++++++++++++++++For more information about this error, try `rustc --explain E0005`.error: could not compile `playground` (bin "playground") due to 1 previous error
Desired output
Rationale and extra context
Adding the else as suggested results in a parse error.
Other cases
Rust Version
Reproducible on the playground with version 1.91.0-nightly (2025-08-16 2e2642e641a941f0a140)
Activity