]> git.lizzy.rs Git - rust.git/blob - tests/ui/mir/mir_match_arm_guard.rs
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
[rust.git] / tests / ui / mir / mir_match_arm_guard.rs
1 // run-pass
2 // #30527 - We were not generating arms with guards in certain cases.
3
4 fn match_with_guard(x: Option<i8>) -> i8 {
5     match x {
6         Some(xyz) if xyz > 100 => 0,
7         Some(_) => -1,
8         None => -2
9     }
10 }
11
12 fn main() {
13     assert_eq!(match_with_guard(Some(111)), 0);
14     assert_eq!(match_with_guard(Some(2)), -1);
15     assert_eq!(match_with_guard(None), -2);
16 }