Skip to content

unreachable_patterns false negative with or_patterns #76836

Closed
@tmiasko

Description

@tmiasko

The match remains exhaustive with highlighted pattern removed, but it does not produce any warnings:

#![feature(or_patterns)]

pub struct A;

pub enum B {
    X,
    Y,
}

pub enum E {
    A(A),
    B(B),
}

pub fn f(e: E) -> () {
    match e {
        E::B(B::X) => (),
        E::B(B::Y | B::X)
        //          ~~~~ 
        | E::A(A) => (),
    }
}

Metadata

Metadata

Assignees

Labels

A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.F-or_patterns`#![feature(or_patterns)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions