]> git.lizzy.rs Git - rust.git/blob - tests/ui/resolve/resolve-inconsistent-names.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / resolve / resolve-inconsistent-names.rs
1 #![allow(non_camel_case_types)]
2
3 enum E { A, B, c }
4
5 pub mod m {
6     const CONST1: usize = 10;
7     pub const Const2: usize = 20;
8 }
9
10 fn main() {
11     let y = 1;
12     match y {
13        a | b => {} //~  ERROR variable `a` is not bound in all patterns
14                    //~| ERROR variable `b` is not bound in all patterns
15     }
16
17     let x = (E::A, E::B);
18     match x {
19         (A, B) | (ref B, c) | (c, A) => ()
20         //~^ ERROR variable `A` is not bound in all patterns
21         //~| ERROR variable `B` is not bound in all patterns
22         //~| ERROR variable `B` is bound inconsistently
23         //~| ERROR mismatched types
24         //~| ERROR variable `c` is not bound in all patterns
25         //~| HELP if you meant to match on unit variant `E::A`, use the full path in the pattern
26         //~| HELP consider removing `ref`
27     }
28
29     let z = (10, 20);
30     match z {
31         (CONST1, _) | (_, Const2) => ()
32         //~^ ERROR variable `CONST1` is not bound in all patterns
33         //~| ERROR variable `Const2` is not bound in all patterns
34         //~| HELP if you meant to match on constant `m::Const2`, use the full path in the pattern
35     }
36 }