about summary refs log tree commit diff
path: root/tests/rustdoc/macro/macro_expansion.rs
blob: c989ccad9671b079ba4556082b206392326c4105 (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
// This test checks that patterns and statements are also getting expanded.

//@ compile-flags: -Zunstable-options --generate-macro-expansion

#![crate_name = "foo"]

//@ has 'src/foo/macro_expansion.rs.html'
//@ count - '//span[@class="expansion"]' 2

macro_rules! pat {
    ($x:literal) => {
        Some($x)
    }
}

macro_rules! stmt {
    ($x:expr) => {{
        let _ = $x;
    }}
}

fn bar() {
    match Some("hello") {
        pat!("blolb") => {}
        _ => {}
    }
    stmt!(1)
}