2023-07-24 04:55:47 +00:00
|
|
|
macro_rules! arm {
|
|
|
|
($pattern:pat => $block:block) => {
|
|
|
|
$pattern => $block
|
2024-04-17 17:08:58 +10:00
|
|
|
//~^ ERROR macro expansion ignores `=>` and any tokens following
|
2023-11-27 03:15:56 +01:00
|
|
|
//~| NOTE the usage of `arm!` is likely invalid in pattern context
|
2023-11-27 00:50:51 +01:00
|
|
|
//~| NOTE macros cannot expand to match arms
|
2023-07-24 04:55:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = Some(1);
|
|
|
|
match x {
|
|
|
|
Some(1) => {},
|
2023-08-02 23:59:30 +00:00
|
|
|
arm!(None => {}),
|
2023-11-27 03:15:56 +01:00
|
|
|
//~^ NOTE caused by the macro expansion here
|
2023-11-27 01:53:05 +01:00
|
|
|
//~| ERROR `match` arm with no body
|
2023-07-24 17:05:10 +00:00
|
|
|
Some(2) => {},
|
2023-07-24 04:55:47 +00:00
|
|
|
_ => {},
|
|
|
|
};
|
|
|
|
}
|