summaryrefslogtreecommitdiffstats
path: root/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.rs
blob: d4067a3359271ee7f54866460399343fd49b45f5 (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
// check-pass
// aux-build:test-macros.rs

#![feature(decl_macro)]
#![feature(stmt_expr_attributes)]

#![no_std] // Don't load unnecessary hygiene information from std
extern crate std;

#[macro_use]
extern crate test_macros;

macro mac {
    (expr $expr:expr) => {
        #[derive(Print)]
        enum E {
            V = { let _ = $expr; 0 },
        }
    },
    (stmt $stmt:stmt) => {
        #[derive(Print)]
        enum E {
            V = { let _ = { $stmt }; 0 },
        }
    },
}

const PATH: u8 = 2;

fn main() {
    mac!(expr #[allow(warnings)] 0);
    mac!(stmt 0);
    mac!(stmt {});
    mac!(stmt PATH);
    mac!(stmt 0 + 1);
    mac!(stmt PATH + 1);
}