]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/or-pattern.rs
Rollup merge of #104822 - spastorino:selctx-new-instead-of-with_query_mode, r=lcnr
[rust.git] / src / test / ui / binding / or-pattern.rs
1 // run-pass
2 #![allow(non_camel_case_types)]
3
4 enum blah { a(isize, isize, #[allow(unused_tuple_struct_fields)] usize), b(isize, isize), c, }
5
6 fn or_alt(q: blah) -> isize {
7     match q { blah::a(x, y, _) | blah::b(x, y) => { return x + y; } blah::c => { return 0; } }
8 }
9
10 pub fn main() {
11     assert_eq!(or_alt(blah::c), 0);
12     assert_eq!(or_alt(blah::a(10, 100, 0)), 110);
13     assert_eq!(or_alt(blah::b(20, 200)), 220);
14 }