]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mir/issue-77359-simplify-arm-identity.rs
Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-dead
[rust.git] / src / test / ui / mir / issue-77359-simplify-arm-identity.rs
1 // run-pass
2
3 #![allow(dead_code)]
4
5 #[derive(Debug)]
6 enum MyEnum {
7     Variant1(Vec<u8>),
8     Variant2,
9     Variant3,
10     Variant4,
11 }
12
13 fn f(arg1: &bool, arg2: &bool, arg3: bool) -> MyStruct {
14     if *arg1 {
15         println!("{:?}", f(&arg2, arg2, arg3));
16         MyStruct(None)
17     } else {
18         match if arg3 { Some(MyEnum::Variant3) } else { None } {
19             Some(t) => {
20                 let ah = t;
21                 return MyStruct(Some(ah));
22             }
23             _ => MyStruct(None)
24         }
25     }
26 }
27
28 #[derive(Debug)]
29 struct MyStruct(Option<MyEnum>);
30
31 fn main() {
32     let arg1 = true;
33     let arg2 = false;
34     f(&arg1, &arg2, true);
35 }