Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tilpner opened this issue Sep 22, 2014 · 1 comment · Fixed by #22300
Closed

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

tilpner opened this issue Sep 22, 2014 · 1 comment · Fixed by #22300
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-syntaxext Area: Syntax extensions

Comments

@tilpner
Copy link
Contributor

tilpner commented Sep 22, 2014

#![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)
@kmcallister
Copy link
Contributor

This is not the same issue as #14660 / #18317.

kmcallister added a commit to kmcallister/rust that referenced this issue Feb 13, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-syntaxext Area: Syntax extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants