Skip to content

Spurious non-exaustive pattern diagnostic #19848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
obsgolem opened this issue May 22, 2025 · 1 comment · Fixed by #19851
Closed

Spurious non-exaustive pattern diagnostic #19848

obsgolem opened this issue May 22, 2025 · 1 comment · Fixed by #19851
Assignees
Labels
C-bug Category: bug

Comments

@obsgolem
Copy link
Contributor

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer version: 0.3.2466-standalone (e464ff8 2025-05-18) [c:\Users\jbills.vscode\extensions\rust-lang.rust-analyzer-0.3.2466-win32-x64\server\rust-analyzer.exe]

rustc version: (eg. output of rustc -V)
rustc 1.87.0 (17067e9ac 2025-05-09)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
VSCode 0.3.2466

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:
Found this because of this: rust-lang/rust#141365

// add your code here
use pubgrub::{OfflineDependencyProvider, PubGrubError, Range};

fn f() -> PubGrubError<OfflineDependencyProvider<String, Range<u32>>> {
    todo!();
}

fn main() {
    let pubgrub::PubGrubError::NoSolution(der) = f();
}

with

pubgrub = { git = "https://github.com/pubgrub-rs/pubgrub.git" }

gives

non-exhaustive pattern: `ErrorRetrievingDependencies { source: !, .. }`, `ErrorChoosingVersion { source: !, .. }` and `ErrorInShouldCancel(!)` not covered

while rustc does nothing. In fact, rustc gives a warning if you try to use refutable pattern matching, making this even more irritating.

@obsgolem obsgolem added the C-bug Category: bug label May 22, 2025
@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented May 22, 2025

Oh this feature was stabilized in Rust 1.82.0, we still hasn't changed it.

Edit: Seems like we did, but we don't normalize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
2 participants