Skip to content

unexpected token: pub for functions implemented via macros in struct impls. #17436

Closed
@tilpner

Description

@tilpner
#![feature(macro_rules)]

struct S;

macro_rules! empty (
    ($i: ident) => (
        #[inline]
        pub fn $i() {}
    )
)

impl S {
    empty!(empty)
}

fn main() {
    let s = S;
    s.empty();
}

fails to compile with

macro_pub.rs:8:9: 8:12 error: unexpected token: `pub`
macro_pub.rs:8         pub fn $i() {}
                       ^~~

on

rustc 0.12.0-pre (4e5b62618 2014-09-21 21:45:28 +0000)

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-syntaxextArea: Syntax extensions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions