2020-06-15 11:50:27 -04:00
|
|
|
// aux-build:test-macros.rs
|
|
|
|
// check-pass
|
2020-07-27 18:02:29 -04:00
|
|
|
// compile-flags: -Z span-debug
|
|
|
|
// normalize-stdout-test "#\d+" -> "#CTXT"
|
2020-06-15 11:50:27 -04:00
|
|
|
|
|
|
|
extern crate test_macros;
|
2020-07-27 18:02:29 -04:00
|
|
|
use test_macros::print_bang;
|
2020-06-15 11:50:27 -04:00
|
|
|
|
|
|
|
macro_rules! use_expr {
|
|
|
|
($expr:expr) => {
|
2020-07-27 18:02:29 -04:00
|
|
|
print_bang!($expr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! use_pat {
|
|
|
|
($pat:pat) => {
|
|
|
|
print_bang!($pat)
|
2020-06-15 11:50:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
struct Foo;
|
|
|
|
impl Foo {
|
|
|
|
#[allow(dead_code)]
|
|
|
|
fn use_self(self) {
|
|
|
|
drop(use_expr!(self));
|
|
|
|
}
|
2020-07-27 18:02:29 -04:00
|
|
|
|
|
|
|
fn with_pat(use_pat!((a, b)): (u32, u32)) {
|
|
|
|
println!("Args: {} {}", a, b);
|
|
|
|
}
|
2020-06-15 11:50:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|