summaryrefslogtreecommitdiffstats
path: root/tests/ui/did_you_mean/bad-assoc-pat.rs
blob: 3f912f7ffc63e5630e6e0ffb214a692006f47dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    match 0u8 {
        [u8]::AssocItem => {}
        //~^ ERROR missing angle brackets in associated item path
        //~| ERROR no associated item named `AssocItem` found
        (u8, u8)::AssocItem => {}
        //~^ ERROR missing angle brackets in associated item path
        //~| ERROR no associated item named `AssocItem` found
        _::AssocItem => {}
        //~^ ERROR missing angle brackets in associated item path
        //~| ERROR no associated item named `AssocItem` found
    }
    match &0u8 {
        &(u8,)::AssocItem => {}
        //~^ ERROR missing angle brackets in associated item path
        //~| ERROR no associated item named `AssocItem` found
    }
}

macro_rules! pat {
    ($ty: ty) => ($ty::AssocItem)
    //~^ ERROR missing angle brackets in associated item path
    //~| ERROR no associated item named `AssocItem` found
}
macro_rules! ty {
    () => (u8)
}

fn check_macros() {
    match 0u8 {
        pat!(u8) => {}
        ty!()::AssocItem => {}
        //~^ ERROR missing angle brackets in associated item path
        //~| ERROR no associated item named `AssocItem` found
    }
}