1
Fork 0

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:
Tyler Mandry 2019-11-26 17:56:23 -06:00 committed by GitHub
commit 7f166e44ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}