mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-13 08:13:21 +00:00
Combine similar tests for const match
See https://github.com/rust-lang/rust/pull/66788#issuecomment-558799307 for context.
This commit is contained in:
parent
809e180a76
commit
9617d7c887
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user