Closed
Description
fn foo() {
let result = Some(1i32);
match result {
Some(r) if r != 0 => {}
None => {}
}
}
The current output is:
Checking mystery v0.1.0 (/home/jsha/learnrust/mystery)
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> src/lib.rs:3:11
|
3 | match result {
| ^^^^^^ pattern `Some(_)` not covered
|
::: /home/jsha/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:518:5
|
518 | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ---- not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `Option<i32>`
For more information about this error, try `rustc --explain E0004`.
Ideally the output should look like:
Checking mystery v0.1.0 (/home/jsha/learnrust/mystery)
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> src/lib.rs:3:11
|
3 | match result {
| ^^^^^^ pattern `Some(_)` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `Option<i32>`
For more information about this error, try `rustc --explain E0004`.
error: could not compile `mystery` due to previous error
The #[stable(...)]
tag is a directive for documentation, but should not be included in this diagnostic.
This bug exists for me locally in stable and nightly, installed via rustup. Oddly, it does not reproduce on the playground.