Skip to content

Commit 7f166e4

Browse files
authored
Rollup merge of #66786 - jyn514:const-if-match-tests, r=Centril
Add wildcard test for const_if_match Closes #66758 Many thanks to @Centril for his help getting me started!
2 parents 84a2d66 + f1f83ef commit 7f166e4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// check-pass
2+
3+
#![feature(const_if_match)]
4+
5+
enum E {
6+
A,
7+
B,
8+
C
9+
}
10+
11+
const fn f(e: E) -> usize {
12+
match e {
13+
_ => 0
14+
}
15+
}
16+
17+
fn main() {
18+
const X: usize = f(E::C);
19+
assert_eq!(X, 0);
20+
assert_eq!(f(E::A), 0);
21+
}

0 commit comments

Comments
 (0)