Skip to content

Procedural macros can be defined inside non-module item in the root module #52270

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
petrochenkov opened this issue Jul 11, 2018 · 1 comment
Closed
Assignees
Labels
A-decl-macros-1-2 Area: Declarative macros 1.2 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@petrochenkov
Copy link
Contributor

Something like this even passes through proc macro registrar generation!

#![feature(proc_macro)]
#![crate_type = "proc-macro"]

extern crate proc_macro;
use proc_macro::*;

fn foo(arg: TokenStream) -> TokenStream {
    #[proc_macro]
    pub fn foo(arg: TokenStream) -> TokenStream { arg }
    
    arg
}

And registrar interprets the outer foo as the proc macro instead of the inner one.

@petrochenkov petrochenkov added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-decl-macros-1-2 Area: Declarative macros 1.2 labels Jul 11, 2018
@petrochenkov petrochenkov self-assigned this Jul 12, 2018
@petrochenkov
Copy link
Contributor Author

Fixed locally, will submit a PR today.

bors added a commit that referenced this issue Jul 14, 2018
proc_macro: Fix crate root detection

Fixes #52270
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-decl-macros-1-2 Area: Declarative macros 1.2 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

1 participant