summaryrefslogtreecommitdiffstats
path: root/tests/ui/or-patterns/mix-with-wild.rs
blob: d9911cda1b6855f74d458c85a864357b9dc807c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test that an or-pattern works with a wild pattern. This tests two things:
//
//  1) The Wild pattern should cause the pattern to always succeed.
//  2) or-patterns should work with simplifyable patterns.

// run-pass

pub fn test(x: Option<usize>) -> bool {
    match x {
        Some(0 | _) => true,
        _ => false,
    }
}

fn main() {
    assert!(test(Some(42)));
    assert!(!test(None));
}