-
-
Notifications
You must be signed in to change notification settings - Fork 15k
No macro hygiene for items #19700
Copy link
Copy link
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Type
Fields
Give feedbackNo fields configured for issues without a type.
Uses of identifiers in a macro expansion refer to identifiers in the macro use-site and not the macro-definition site, effectively giving macros dynamic scope.
Minimal example:
Testing this program will result in a test failure because when
bar!()expands tofoo()thefoois thefooin the test submodule, whereas it should refer to thefooin the top-level module wherebar!was defined.This paper is a good resource for implementing this: http://www.cs.utah.edu/plt/publications/macromod.pdf