mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-24 06:04:21 -04:00
Fortify tests againts mir-opts.
This commit is contained in:
@@ -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"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user