Skip to content

Commit 6cc9cac

Browse files
committed
Add test for #[non_exhaustive] enum in match_wildcard_for_single-variant
1 parent 0b7ab90 commit 6cc9cac

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/ui/match_wildcard_for_single_variants.fixed

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,16 @@ fn main() {
9696
Some(_) => 1,
9797
_ => 2,
9898
};
99+
100+
#[non_exhaustive]
101+
enum Bar {
102+
A,
103+
B,
104+
C,
105+
}
106+
match Bar::A {
107+
Bar::A => (),
108+
Bar::B => (),
109+
_ => (),
110+
};
99111
}

tests/ui/match_wildcard_for_single_variants.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,16 @@ fn main() {
9696
Some(_) => 1,
9797
_ => 2,
9898
};
99+
100+
#[non_exhaustive]
101+
enum Bar {
102+
A,
103+
B,
104+
C,
105+
}
106+
match Bar::A {
107+
Bar::A => (),
108+
Bar::B => (),
109+
_ => (),
110+
};
99111
}

0 commit comments

Comments
 (0)