Skip to content

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

Closed
@petrochenkov

Description

@petrochenkov

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.

Metadata

Metadata

Assignees

Labels

A-decl-macros-1-2Area: Declarative macros 1.2E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions