Skip to content

Tracking Issue for #![feature(non_exhaustive_omitted_patterns_lint)] #89554

Open

Description

@Nadrieril

View all comments

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

Unresolved Questions

Implementation history

Activity

  1. added
    A-lintsArea: 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 RFC
    A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patterns
    T-langRelevant to the language team
    on Oct 5, 2021
  2. DevinR528 commented on Oct 7, 2021

    @DevinR528
  3. Nadrieril commented on Oct 11, 2021

    @Nadrieril
    MemberAuthor

    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.

  4. DevinR528 commented on Oct 13, 2021

    @DevinR528
    Contributor

    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 filtering doc(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.

  5. Nadrieril commented on Oct 13, 2021

    @Nadrieril
    MemberAuthor

    Yeah, don't think there's any formal guarantee and they do change in small ways regularly

  6. added a commit that references this issue on Mar 12, 2022
  7. 19 remaining items

  8. Nadrieril commented on Dec 8, 2023

    @Nadrieril
    MemberAuthor

    I discovered something cool today: non_exhaustive_omitted_patterns will warn in the following case if we add variants to Enum, which an exhaustiveness-based check wouldn't catch:

    #[warn(non_exhaustive_omitted_patterns)]
    match (x, y) {
        (Enum::A, Enum::A) => true,
        (Enum::B, Enum::B) => true,
        _ => false,
    }

    I kind of want this for arbitrary enums now.

  9. Nadrieril commented on Dec 8, 2023

    @Nadrieril
    MemberAuthor

    Maybe this could be a general #[warn(mention_all_variants_of(Enum))]

  10. dtolnay commented on Jan 5, 2025

    @dtolnay
    Member

    There is a false positive involving the standard library matches! macro: #135137

  11. jonhoo commented on Oct 21, 2025

    @jonhoo
    Contributor

    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?

  12. Nadrieril commented on Nov 5, 2025

    @Nadrieril
    MemberAuthor

    That seems to be a much more general feature request: currently we don't do anything particular with must_use in patterns at all. Feel free to open a feature request for that.

  13. andrewbaxter commented on Nov 28, 2025

    @andrewbaxter

    #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.

  14. Nadrieril commented on Nov 30, 2025

    @Nadrieril
    MemberAuthor

    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.

  15. jplatte commented on Aug 3, 2026

    @jplatte
    Contributor

    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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsA-lintsArea: 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 RFCF-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 PRT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions