summary refs log tree commit diff
path: root/src/test/ui/proc-macro/capture-macro-rules-invoke.rs
blob: 2ff6ad6d68f35a0d930e5159a3ce06d975a1b6c3 (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
// aux-build:test-macros.rs
// check-pass
// compile-flags: -Z span-debug
// normalize-stdout-test "#\d+" -> "#CTXT"

extern crate test_macros;
use test_macros::print_bang;

macro_rules! use_expr {
    ($expr:expr) => {
        print_bang!($expr)
    }
}

macro_rules! use_pat {
    ($pat:pat) => {
        print_bang!($pat)
    }
}

#[allow(dead_code)]
struct Foo;
impl Foo {
    #[allow(dead_code)]
    fn use_self(self) {
        drop(use_expr!(self));
    }

    fn with_pat(use_pat!((a, b)): (u32, u32)) {
        println!("Args: {} {}", a, b);
    }
}

fn main() {}