Combine similar tests for const match

See https://github.com/rust-lang/rust/pull/66788#issuecomment-558799307
for context.
This commit is contained in:
Joshua Nelson 2019-11-27 00:02:04 -05:00
parent 809e180a76
commit 9617d7c887
2 changed files with 11 additions and 22 deletions

View File

@ -18,4 +18,14 @@ const fn f(e: E) {
}
}
fn main() {}
const fn g(e: E) -> usize {
match e {
_ => 0
}
}
fn main() {
const X: usize = g(E::C);
assert_eq!(X, 0);
assert_eq!(g(E::A), 0);
}

View File

@ -1,21 +0,0 @@
// 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);
}