using feature exhaustive_patterns doesn't seem to work while rustc handle it
rust-analyzer version: rust-analyzer version: 0.0.0 (5342f47f4 2022-07-09)
rustc version: rustc 1.62.0-nightly (52ca603da 2022-04-12)
#![feature(never_type)]
#![feature(exhaustive_patterns)]
use core::convert::Infallible;
fn foo() -> Result<(), !> {
Ok(())
}
fn bar() -> Result<(), Infallible> {
Ok(())
}
fn main() {
match foo() {
Ok(()) => println!("Ok"),
}
match bar() {
Ok(()) => println!("Ok"),
}
}
It seem rust-analizer have trouble with feature exhaustive_patterns.
The concrete issue is that the second match is erroneously reported as non-exhaustive .
Related fixmes https://github.com/rust-lang/rust-analyzer/blob/4cbf23c192517cfebb0d754987aae95bc683b7a4/crates/hir-ty/src/diagnostics/match_check/usefulness.rs#L295-L299 https://github.com/rust-lang/rust-analyzer/blob/4cbf23c192517cfebb0d754987aae95bc683b7a4/crates/hir-ty/src/diagnostics/match_check/usefulness.rs#L314-L318
I think I might also be running into the same issue in rust-lang/rust.
https://github.com/rust-lang/rust/blob/master/library/core/src/cell/once.rs#L125 produces a "Err(_) not covered" error in rust-analyzer as of the c9e134e1b609e571f4d7d18f91f0ccb1a0cb685d commit in rust-lang/rust. Not sure how to confirm exactly which version of rust-analyzer I'm using since I'm doing this via vscode on one of the foundation cloud desktops and am quite unfamiliar with this setup.