mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
25 lines
420 B
Rust
25 lines
420 B
Rust
//@ run-pass
|
|
|
|
macro_rules! stringify_item {
|
|
($item:item) => {
|
|
stringify!($item)
|
|
};
|
|
}
|
|
|
|
macro_rules! repro {
|
|
($expr:expr) => {
|
|
stringify_item! {
|
|
pub fn repro() -> bool {
|
|
$expr
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(
|
|
repro!(match () { () => true } | true),
|
|
"pub fn repro() -> bool { (match () { () => true, }) | true }"
|
|
);
|
|
}
|