2023-07-23 23:55:47 -05:00
|
|
|
macro_rules! arm {
|
|
|
|
($pattern:pat => $block:block) => {
|
|
|
|
$pattern => $block
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = Some(1);
|
|
|
|
match x {
|
|
|
|
Some(1) => {},
|
2023-08-02 18:59:30 -05:00
|
|
|
arm!(None => {}),
|
|
|
|
//~^ NOTE macros cannot expand to match arms
|
|
|
|
//~| ERROR unexpected `,` in pattern
|
2023-07-24 12:05:10 -05:00
|
|
|
// doesn't recover
|
|
|
|
Some(2) => {},
|
2023-07-23 23:55:47 -05:00
|
|
|
_ => {},
|
|
|
|
};
|
|
|
|
}
|