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

non_exhaustive_omitted_patterns is missing span #109837

Closed
Noratrieb opened this issue Apr 1, 2023 · 2 comments · Fixed by #109838
Closed

non_exhaustive_omitted_patterns is missing span #109837

Noratrieb opened this issue Apr 1, 2023 · 2 comments · Fixed by #109838
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-non_exhaustive_omitted_patterns_lint `#![feature(non_exhaustive_omitted_patterns_lint)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Noratrieb
Copy link
Member

Noratrieb commented Apr 1, 2023

Currently, I get the following error message:

error: some variants are not matched explicitly
   |
note: the lint level is defined here
  --> selene-lib/src/rules/high_cyclomatic_complexity.rs:77:14
   |
77 |         deny(non_exhaustive_omitted_patterns)
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: ensure that all variants are matched explicitly by adding the suggested match arms
   = note: the matched value is of type `full_moon::ast::Value` and the `non_exhaustive_omitted_patterns` attribute was found

error: some variants are not matched explicitly
  |
  = help: ensure that all variants are matched explicitly by adding the suggested match arms
  = note: the matched value is of type `full_moon::ast::Expression` and the `non_exhaustive_omitted_patterns` attribute was found

error: some variants are not matched explicitly
    |
note: the lint level is defined here
   --> selene-lib/src/rules/high_cyclomatic_complexity.rs:180:18
    |
180 |             deny(non_exhaustive_omitted_patterns)
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: ensure that all variants are matched explicitly by adding the suggested match arms
    = note: the matched value is of type `full_moon::ast::Stmt` and the `non_exhaustive_omitted_patterns` attribute was found

error: could not compile `selene-lib` due to 3 previous errors

This error message is correct, but not helpful, and confused the person writing the pull request who hit this issue. It does not show what the variants are or where the match is. I would file a repro but I'm fairly sure non_exhaustive is ignored in the same crate, so it would not be doable on playground.

Originally posted by @Kampfkarren in #89554 (comment)

@Noratrieb Noratrieb added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. 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. C-bug Category: This is a bug. F-non_exhaustive_omitted_patterns_lint `#![feature(non_exhaustive_omitted_patterns_lint)]` labels Apr 1, 2023
@Noratrieb
Copy link
Member Author

Noratrieb commented Apr 1, 2023

I hit this today when matching on syn::Item, so it's still around. The lint also doesn't mention which variants were not covered, which is pretty hard to debug (I had to manually compare my match with the enum definition).

@clubby789
Copy link
Contributor

This doesn't seem to trigger for smaller examples, so I'll try and minimize the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-non_exhaustive_omitted_patterns_lint `#![feature(non_exhaustive_omitted_patterns_lint)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants