summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene/assoc_item_ctxt.rs
blob: 65593d1d560774ed4bd28a5a4d265ee4283e8e66 (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
37
38
39
40
41
42
// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro)]
#![allow(unused)]

mod ok {
    macro mac_trait_item($method: ident) {
        fn $method();
    }

    trait Tr {
        mac_trait_item!(method);
    }

    macro mac_trait_impl() {
        impl Tr for u8 { // OK
            fn method() {} // OK
        }
    }

    mac_trait_impl!();
}

mod error {
    macro mac_trait_item() {
        fn method();
    }

    trait Tr {
        mac_trait_item!();
    }

    macro mac_trait_impl() {
        impl Tr for u8 { //~ ERROR not all trait items implemented, missing: `method`
            fn method() {} //~ ERROR method `method` is not a member of trait `Tr`
        }
    }

    mac_trait_impl!();
}

fn main() {}