]> git.lizzy.rs Git - rust.git/blob - src/test/ui/or-patterns/bindings-runpass-1.rs
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
[rust.git] / src / test / ui / or-patterns / bindings-runpass-1.rs
1 // run-pass
2
3 fn two_bindings(x: &((bool, bool), u8)) -> u8 {
4     match x {
5         &((true, y) | (y, true), z @ (0 | 4)) => (y as u8) + z,
6         _ => 20,
7     }
8 }
9
10 fn main() {
11     assert_eq!(two_bindings(&((false, false), 0)), 20);
12     assert_eq!(two_bindings(&((false, true), 0)), 0);
13     assert_eq!(two_bindings(&((true, false), 0)), 0);
14     assert_eq!(two_bindings(&((true, true), 0)), 1);
15     assert_eq!(two_bindings(&((false, false), 4)), 20);
16     assert_eq!(two_bindings(&((false, true), 4)), 4);
17     assert_eq!(two_bindings(&((true, false), 4)), 4);
18     assert_eq!(two_bindings(&((true, true), 4)), 5);
19     assert_eq!(two_bindings(&((false, false), 3)), 20);
20     assert_eq!(two_bindings(&((false, true), 3)), 20);
21     assert_eq!(two_bindings(&((true, false), 3)), 20);
22     assert_eq!(two_bindings(&((true, true), 3)), 20);
23 }