Skip to content
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

pattern check ignores if guards #3173

Open
1 task
tamaroning opened this issue Sep 19, 2024 · 0 comments
Open
1 task

pattern check ignores if guards #3173

tamaroning opened this issue Sep 19, 2024 · 0 comments

Comments

@tamaroning
Copy link
Contributor

Summary

related to #3172

Reproducer

I tried this code:

enum E {
    A(),
    B(),
}

fn f(e: E) {
    match e {
        E::A() if true => {}
        //E::B => {}
    }
}

Does the code make use of any (1.49) nightly feature ?

  • Nightly

Godbolt link

https://godbolt.org/z/97fnfov7h

Actual behavior

The current behavior is...

<source>:7:11: error: non-exhaustive patterns: 'E::B()' not covered
    7 |     match e {
      |           ^
Compiler returned: 1

Expected behavior

I expected to see...

error[E0004]: non-exhaustive patterns: `A` and `B` not covered
 --> <source>:7:11
  |
1 | / enum E {
2 | |     A(),
  | |     - not covered
3 | |     B(),
  | |     - not covered
4 | | }
  | |_- `E` defined here
...
7 |       match e {
  |             ^ patterns `A` and `B` 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 `E`

error: aborting due to previous error

GCC Version

67bc0f6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant