Repository navigation
Tracking Issue for #![feature(non_exhaustive_omitted_patterns_lint)] #89554
Copy link
Copy link
Open
Labels
A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-non_exhaustive_omitted_patterns_lint`#![feature(non_exhaustive_omitted_patterns_lint)]``#![feature(non_exhaustive_omitted_patterns_lint)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Description
This is a tracking issue for the non_exhaustive_omitted_patterns lint.
The feature gate for the issue is #![feature(non_exhaustive_omitted_patterns_lint)].
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implemented in Add non_exhaustive_omitted_patterns lint related to rfc-2008-non_exhaustive #86809
- Set a feature gate Feature gate the non_exhaustive_omitted_patterns lint #89428
- Adjust documentation (see instructions on rustc-dev-guide) — https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#non-exhaustive-omitted-patterns
- Clippy false positive False positive in match_same_arms + non_exhaustive_omitted_patterns rust-clippy#10327
-
matches!false positive False positive in non_exhaustive_omitted_patterns:matches!#135137 - Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- Lint name is potentially unclear New non_exhaustive_omitted_patterns lint exposes unstable and hidden enum variants. #89042 (comment)
- Lint message needs to be improved Feature gate the non_exhaustive_omitted_patterns lint #89428 (comment)
Implementation history
- Implemented in Add non_exhaustive_omitted_patterns lint related to rfc-2008-non_exhaustive #86809
- ICE was discovered in ICE related to non_exhaustive_omitted_patterns lint #89382 and fixed Fix ICE caused by non_exaustive_omitted_patterns struct lint #89423
- Feature gate PR Feature gate the non_exhaustive_omitted_patterns lint #89428
- A bug was discovered in New non_exhaustive_omitted_patterns lint exposes unstable and hidden enum variants. #89042 and fixed Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants #89105
- Filter out unstable/hidden fields too
non_exhaustive_omitted_patternslint exposes unstable and hidden fields #89837 - Rework the lint to make it more consistent Lint
non_exhaustive_omitted_patternsby columns #116734 - Warn users to not set the lint level on a single arm as was previously recommended Warn users who set
non_exhaustive_omitted_patternslint level on a match arm #117094
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-non_exhaustive_omitted_patterns_lint`#![feature(non_exhaustive_omitted_patterns_lint)]``#![feature(non_exhaustive_omitted_patterns_lint)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Activity
DevinR528 commentedon Oct 7, 2021
Nadrieril commentedon Oct 11, 2021
In terms of the "documentation" bullet-point, the lint should turn up automatically on that list and I think that's enough. So we'll only need to check that it says the right thing once we've ironed out the name and message etc.
DevinR528 commentedon Oct 13, 2021
The question about not filtering
doc(hidden)(and maybe this was only me feeling like it was odd) is kind of resolved for me since we unified the behavior so I no longer have the argument that filteringdoc(hidden)variants/fields out of error and warning messages is not the norm (now it is done for all exhaustiveness checking).I'm also curious about the stability of warning/error messages, I assume rust makes no guarantee so they can be improved quickly.
Nadrieril commentedon Oct 13, 2021
Yeah, don't think there's any formal guarantee and they do change in small ways regularly
Auto merge of rust-lang#90358 - DevinR528:omitted-field-fix, r=jackh726
Update dependencies
Update dependencies
Update dependencies
Update dependencies
19 remaining items
Nadrieril commentedon Dec 8, 2023
I discovered something cool today:
non_exhaustive_omitted_patternswill warn in the following case if we add variants toEnum, which an exhaustiveness-based check wouldn't catch:I kind of want this for arbitrary enums now.
Nadrieril commentedon Dec 8, 2023
Maybe this could be a general
#[warn(mention_all_variants_of(Enum))]dtolnay commentedon Jan 5, 2025
There is a false positive involving the standard library
matches!macro: #135137jonhoo commentedon Oct 21, 2025
I wonder if there's a missing piece here where we should have warn-by-default: if one of the omitted fields are a
#[must_use]type?Nadrieril commentedon Nov 5, 2025
That seems to be a much more general feature request: currently we don't do anything particular with
must_usein patterns at all. Feel free to open a feature request for that.andrewbaxter commentedon Nov 28, 2025
#135137 = #117304 was resolved back in July, the only thing left seems to be stabilization?
Has there been any discussion on the unresolved questions? If nobody's saying anything they don't seem critical.
I'd very like to see this stabilized too, regardless of the name. I've been bitten by missed critical cases a few too many times now.
Nadrieril commentedon Nov 30, 2025
Yeah this would need stabilization work; I'm not sold on the name nor design of this though, I'm hoping someone would have better ideas. I also kinda think this would fit better as a clippy lint. This was implemented in the compiler because it requires access to some match exhaustiveness logic, but the match exhaustivenesss logic has been librarified into a reusable crate now (r-a uses it!) so this could be moved to clippy now.
Add missing error variant conversion (#7628)
Add missing error variant conversion (unicode-org#7628)
feat(core): Story 1.3 — StepTimeoutFired event + workspace non_exhaus…
docs(architecture): correct unstable-lint MSRV claim + mark aspiratio…
review(governance): address bugbot/meroreviewer comments on phase 1+2
fix(strict-lint): enable non_exhaustive_omitted_patterns feature on p…
jplatte commentedon Aug 3, 2026
The second-to-last step in the issue description can be closed, I fixed it last year in #144331.
Now it's just a matter of somebody taking care of the stabilization :)