]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-13867.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-13867.rs
1 // run-pass
2 // Test that codegen works correctly when there are multiple refutable
3 // patterns in match expression.
4
5 enum Foo {
6     FooUint(usize),
7     FooNullary,
8 }
9
10 fn main() {
11     let r = match (Foo::FooNullary, 'a') {
12         (Foo::FooUint(..), 'a'..='z') => 1,
13         (Foo::FooNullary, 'x') => 2,
14         _ => 0
15     };
16     assert_eq!(r, 0);
17
18     let r = match (Foo::FooUint(0), 'a') {
19         (Foo::FooUint(1), 'a'..='z') => 1,
20         (Foo::FooUint(..), 'x') => 2,
21         (Foo::FooNullary, 'a') => 3,
22         _ => 0
23     };
24     assert_eq!(r, 0);
25
26     let r = match ('a', Foo::FooUint(0)) {
27         ('a'..='z', Foo::FooUint(1)) => 1,
28         ('x', Foo::FooUint(..)) => 2,
29         ('a', Foo::FooNullary) => 3,
30         _ => 0
31     };
32     assert_eq!(r, 0);
33
34     let r = match ('a', 'a') {
35         ('a'..='z', 'b') => 1,
36         ('x', 'a'..='z') => 2,
37         _ => 0
38     };
39     assert_eq!(r, 0);
40
41     let r = match ('a', 'a') {
42         ('a'..='z', 'b') => 1,
43         ('x', 'a'..='z') => 2,
44         ('a', 'a') => 3,
45         _ => 0
46     };
47     assert_eq!(r, 3);
48 }