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:
commit
7f166e44ff
1 changed files with 21 additions and 0 deletions
21
src/test/ui/consts/control-flow/single-arm-match-wild.rs
Normal file
21
src/test/ui/consts/control-flow/single-arm-match-wild.rs
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue