non-exhaustive pattern error should mention existence of #[non_exhaustive] attribute #85227
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The error message when matching exhaustively on a non-exhaustive enum is as follows:
(note that this error only occurs when the enum is defined in another crate and with the
#[non_exhaustive]
attribute)Ideally the output should look like:
It's often easy to miss the
non_exhaustive
attribute (both in the docs and when reading source code with a lot of type attributes), leading to confusion. I was personally caught by this, and I think it would be useful if the compiler was able to communicate to the user the true cause of the issue.The text was updated successfully, but these errors were encountered: