rust/rustfmt-core/tests/target/macro_rules.rs

54 lines
773 B
Rust
Raw Normal View History

2018-01-24 13:09:49 -06:00
macro_rules! m {
2018-01-30 11:05:31 -06:00
// a
2018-01-25 08:20:17 -06:00
($expr: expr, $($func: ident)*) => {{
2018-01-25 08:06:37 -06:00
let x = $expr;
$func(x)
}};
2018-01-24 13:09:49 -06:00
2018-01-30 11:05:31 -06:00
/* b */
() => {
/* c */
};
(@tag) => {};
2018-01-24 13:09:49 -06:00
2018-01-30 11:05:31 -06:00
// d
2018-01-24 13:09:49 -06:00
($item: ident) => {
mod macro_item {
struct $item;
}
};
}
2018-01-30 11:05:31 -06:00
macro m2 {
// a
($expr: expr, $($func: ident)*) => {{
let x = $expr;
$func(x)
}}
/* b */
() => {
/* c */
}
(@tag) => {}
// d
($item: ident) => {
mod macro_item {
struct $item;
}
}
}
// #2439
macro_rules! m {
(
$line0_xxxxxxxxxxxxxxxxx: expr,
$line1_xxxxxxxxxxxxxxxxx: expr,
$line2_xxxxxxxxxxxxxxxxx: expr,
$line3_xxxxxxxxxxxxxxxxx: expr,
) => {};
}