Closed
Description
I just noticed this regression from 1.60 to 1.61 because TRPL reasons.
Code
Given the following code:
fn main() {
let some_option_value: Option<i32> = None;
let Some(x) = some_option_value;
}
The current output is:
error[E0005]: refutable pattern in local binding: `None` not covered
--> src/main.rs:3:9
|
3 | let Some(x) = some_option_value;
| ^^^^^^^ 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/ch18-02-refutability.html
note: `Option<i32>` defined here
= note: the matched value is of type `Option<i32>`
help: you might want to use `if let` to ignore the variant that isn't matched
|
3 | let x = if let Some(x) = some_option_value { x } else { todo!() };
| ++++++++++ ++++++++++++++++++++++
Notice especially this line:
note: `Option<i32>` defined here
Which... raises a few questions...
- I definitely did not define
Option<i32>
in this code, so I don't know why this note is saying I did - Or is it saying that? The note doesn't point to what it thinks "here" is.
- What is this note trying to tell me about, really?
Ideally the output shouldn't have this line, I don't think.
Versions with regression
This problem started with 1.61 and still exists in 1.63.0, 1.64.0-beta.3, and nightly 2022-08-25 7480389.
@rustbot modify labels: +regression-untriaged