mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Rollup merge of #66786 - jyn514:const-if-match-tests, r=Centril
Add wildcard test for const_if_match Closes https://github.com/rust-lang/rust/issues/66758 Many thanks to @Centril for his help getting me started!
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(const_if_match)]
|
||||
|
||||
enum E {
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
const fn f(e: E) -> usize {
|
||||
match e {
|
||||
_ => 0
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
const X: usize = f(E::C);
|
||||
assert_eq!(X, 0);
|
||||
assert_eq!(f(E::A), 0);
|
||||
}
|
||||
Reference in New Issue
Block a user