rust/tests/ui/proc-macro/expr-stmt-nonterminal-tokens.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
671 B
Rust
Raw Normal View History

// 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);
}