Skip to content

Item macros inside of impls don't work #4661

Closed
@brendanzab

Description

@brendanzab
macro_rules! printer_method {
    { $id:ident : $string:expr } => {
        pure fn $id () { io::println($string) }
    }
}

type MyInt = int;

impl MyInt {
    printer_method!{ ~"Hullo folks." }
}

fn main() {}
$ rustc macro-in-impl.rs
macro-in-impl.rs:10:4: 10:18 error: unexpected token: `printer_method`
macro-in-impl.rs:10     printer_method!{ ~"Hullo folks." }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions