about summary refs log tree commit diff
path: root/tests/ui/hygiene/rustc-macro-transparency.rs
blob: 1a78a7543cfdc129da1ba800d3391d49c6eae290 (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
#![feature(decl_macro, rustc_attrs)]

#[rustc_macro_transparency = "transparent"]
macro transparent() {
    struct Transparent;
    let transparent = 0;
}
#[rustc_macro_transparency = "semitransparent"]
macro semiopaque() {
    struct SemiOpaque;
    let semiopaque = 0;
}
#[rustc_macro_transparency = "opaque"]
macro opaque() {
    struct Opaque;
    let opaque = 0;
}

fn main() {
    transparent!();
    semiopaque!();
    opaque!();

    Transparent; // OK
    SemiOpaque; // OK
    Opaque; //~ ERROR cannot find value `Opaque` in this scope

    transparent; // OK
    semiopaque; //~ ERROR expected value, found macro `semiopaque`
    opaque; //~ ERROR expected value, found macro `opaque`
}