]> git.proxmox.com Git - rustc.git/blob - src/test/ui/or-patterns/mix-with-wild.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / ui / or-patterns / mix-with-wild.rs
1 // Test that an or-pattern works with a wild pattern. This tests two things:
2 //
3 // 1) The Wild pattern should cause the pattern to always succeed.
4 // 2) or-patterns should work with simplifyable patterns.
5
6 // run-pass
7
8 pub fn test(x: Option<usize>) -> bool {
9 match x {
10 Some(0 | _) => true,
11 _ => false,
12 }
13 }
14
15 fn main() {
16 assert!(test(Some(42)));
17 assert!(!test(None));
18 }