Skip to content

Macros don't get expanded when used in item name token position #4365

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
vadimcn opened this issue Jan 7, 2013 · 2 comments
Closed

Macros don't get expanded when used in item name token position #4365

vadimcn opened this issue Jan 7, 2013 · 2 comments

Comments

@vadimcn
Copy link
Contributor

vadimcn commented Jan 7, 2013

All of the examples below fail to compile with an error similar to the following:
test.rs:1:16: 1:17 error: expected ( but found !
test.rs:1 fn concat_idents!(foo, bar) () {}
^

fn concat_idents!(foo, bar) () {}
trait concat_idents!(foo, bar) {}
mod concat_idents!(foo, bar) {}
let concat_idents!(foo, bar) = 0;

@vadimcn
Copy link
Contributor Author

vadimcn commented Jan 10, 2013

Hmm, ok, I see. I failed to grok the following sentence during my first ten readings of the Macro Tutorial: "A macro invocation may take the place of (and therefore expand to) either an expression, an item, or a statement".
Too bad, this makes concat_idents!() way less useful than I thought...

@catamorphism
Copy link
Contributor

I don't think we're planning to extend the macro system in this way, but feel free to make another issue requesting it as an RFC :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants