External Publication
Visit Post

Why can't pat_param be followed by a colon in macro_rules?

Rust Internals [Unofficial] June 13, 2026
Source

I would also like it if we didn't lift this restriction, because I'd like to reuse top-level pattern type ascription as the syntax to obtain access to anonymous enum variants:

fn foo() -> A | B { todo!() }

match foo() {
    x: A => {}
    x: B => {}
}

Discussion in the ATmosphere

Loading comments...