]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/expr-stmt-nonterminal-tokens.rs
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
[rust.git] / tests / ui / proc-macro / expr-stmt-nonterminal-tokens.rs
1 // check-pass
2 // aux-build:test-macros.rs
3
4 #![feature(decl_macro)]
5 #![feature(stmt_expr_attributes)]
6
7 #![no_std] // Don't load unnecessary hygiene information from std
8 extern crate std;
9
10 #[macro_use]
11 extern crate test_macros;
12
13 macro mac {
14     (expr $expr:expr) => {
15         #[derive(Print)]
16         enum E {
17             V = { let _ = $expr; 0 },
18         }
19     },
20     (stmt $stmt:stmt) => {
21         #[derive(Print)]
22         enum E {
23             V = { let _ = { $stmt }; 0 },
24         }
25     },
26 }
27
28 const PATH: u8 = 2;
29
30 fn main() {
31     mac!(expr #[allow(warnings)] 0);
32     mac!(stmt 0);
33     mac!(stmt {});
34     mac!(stmt PATH);
35     mac!(stmt 0 + 1);
36     mac!(stmt PATH + 1);
37 }