Skip to content

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

@Nadrieril

Description

@Nadrieril
Member

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

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
DevinR528

DevinR528 commented on Oct 7, 2021

@DevinR528
Nadrieril

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.

DevinR528

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.

Nadrieril

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

30 remaining items

Nadrieril

Nadrieril commented on Oct 23, 2023

@Nadrieril
MemberAuthor

#116734 changed the behavior of the lint to match what I proposed above

Nadrieril

Nadrieril commented on Oct 23, 2023

@Nadrieril
MemberAuthor

Note: the lint level can no longer be put on a match arm, it needs to be on the whole match. This is a silent breaking change.

I thought it was ok because the feature is unstable, but turns out syn is using the lint and recommending to put the lint level on the match arm. I'll try to make the breaking change not silent at least.

EDIT: did that in #117094

added a commit that references this issue on Oct 27, 2023
added a commit that references this issue on Nov 4, 2023
Nadrieril

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.

Nadrieril

Nadrieril commented on Dec 8, 2023

@Nadrieril
MemberAuthor

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

dtolnay

dtolnay commented on Jan 5, 2025

@dtolnay
Member

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

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

        Participants

        @Nemo157@joshtriplett@dtolnay@Kampfkarren@Nadrieril

        Issue actions

          Tracking Issue for `#![feature(non_exhaustive_omitted_patterns_lint)]` · Issue #89554 · rust-lang/rust