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

Improve error message for non-exhaustive matches on non-exhaustive enums #85233

Merged
merged 1 commit into from May 14, 2021

Conversation

FabianWolff
Copy link
Contributor

This pull request fixes #85227. For an enum marked with #[non_exhaustive] and not defined in the current crate, the error message for non-exhaustive matches now mentions the fact that the enum is marked as non-exhaustive:

error[E0004]: non-exhaustive patterns: `_` not covered
  --> main.rs:12:11
   |
12 |     match e {
   |           ^ pattern `_` 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`, which is marked as non-exhaustive

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2021
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 13, 2021

📌 Commit 57291b8 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 13, 2021
@bors
Copy link
Contributor

bors commented May 14, 2021

⌛ Testing commit 57291b8 with merge 69b352e...

@bors
Copy link
Contributor

bors commented May 14, 2021

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 69b352e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 14, 2021
@bors bors merged commit 69b352e into rust-lang:master May 14, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

non-exhaustive pattern error should mention existence of #[non_exhaustive] attribute
5 participants