mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-06 04:06:31 +00:00
29 lines
492 B
Rust
29 lines
492 B
Rust
// 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)
|
|
}
|