Fortify tests againts mir-opts.

This commit is contained in:
Camille GILLOT 2023-04-11 17:20:54 +00:00
parent b0884a3528
commit 65c334ee8c
2 changed files with 18 additions and 17 deletions

View File

@ -23,14 +23,4 @@ fn some_match(result: OpenResult) -> u8 {
fn main() {
let result = OpenResult::Ok(());
assert_eq!(some_match(result), 0);
let result = OpenResult::Ok(());
match result {
OpenResult::Ok(()) => (),
_ => unreachable!("message a"),
}
match result {
OpenResult::Ok(()) => (),
_ => unreachable!("message b"),
}
}

View File

@ -55,12 +55,23 @@ pub enum E2<X> {
V4,
}
fn main() {
if let E1::V2 { .. } = (E1::V1 { f: true }) {
unreachable!()
}
if let E2::V1 { .. } = E2::V3::<Infallible> {
unreachable!()
#[inline(never)]
fn match_e1(y: E1) -> u8 {
match y {
E1::V2 { .. } => 1,
_ => 0,
}
}
#[inline(never)]
fn match_e2(y: E2<Infallible>) -> u8 {
match y {
E2::V1 { .. } => 1,
_ => 0,
}
}
fn main() {
assert_eq!(match_e1(E1::V1 { f: true }), 0);
assert_eq!(match_e2(E2::V3), 0);
}