mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
19 lines
366 B
Rust
19 lines
366 B
Rust
macro_rules! arm {
|
|
($pattern:pat => $block:block) => {
|
|
$pattern => $block
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
let x = Some(1);
|
|
match x {
|
|
Some(1) => {},
|
|
arm!(None => {}),
|
|
//~^ NOTE macros cannot expand to match arms
|
|
//~| ERROR unexpected `,` in pattern
|
|
// doesn't recover
|
|
Some(2) => {},
|
|
_ => {},
|
|
};
|
|
}
|