Skip to content

Macros can't expand to 'match' alternatives #12832

Closed
@kmcallister

Description

@kmcallister
macro_rules! foo (() => (
    2 => "two"
))

fn main() {
    match 2 {
        foo!(),
        _ => "not two",
    }
}
$ rustc -v
rustc 0.10-pre (6ae5de0 2014-02-19 12:51:48 -0800)
host: x86_64-unknown-linux-gnu
$ rustc foo.rs
foo.rs:7:12: 7:13 error: expected `=>` but found `!`
foo.rs:7         foo!(),
                    ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions