Skip to content

Commit 65c334e

Browse files
committed
Fortify tests againts mir-opts.
1 parent b0884a3 commit 65c334e

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

tests/ui/enum-discriminant/issue-104519.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,4 @@ fn some_match(result: OpenResult) -> u8 {
2323
fn main() {
2424
let result = OpenResult::Ok(());
2525
assert_eq!(some_match(result), 0);
26-
27-
let result = OpenResult::Ok(());
28-
match result {
29-
OpenResult::Ok(()) => (),
30-
_ => unreachable!("message a"),
31-
}
32-
match result {
33-
OpenResult::Ok(()) => (),
34-
_ => unreachable!("message b"),
35-
}
3626
}

tests/ui/issues/issue-61696.rs renamed to tests/ui/enum-discriminant/issue-61696.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,23 @@ pub enum E2<X> {
5555
V4,
5656
}
5757

58-
fn main() {
59-
if let E1::V2 { .. } = (E1::V1 { f: true }) {
60-
unreachable!()
58+
#[inline(never)]
59+
fn match_e1(y: E1) -> u8 {
60+
match y {
61+
E1::V2 { .. } => 1,
62+
_ => 0,
6163
}
64+
}
6265

63-
if let E2::V1 { .. } = E2::V3::<Infallible> {
64-
unreachable!()
66+
#[inline(never)]
67+
fn match_e2(y: E2<Infallible>) -> u8 {
68+
match y {
69+
E2::V1 { .. } => 1,
70+
_ => 0,
6571
}
6672
}
73+
74+
fn main() {
75+
assert_eq!(match_e1(E1::V1 { f: true }), 0);
76+
assert_eq!(match_e2(E2::V3), 0);
77+
}

0 commit comments

Comments
 (0)