non-hygienic lifetime-shadowing check can make macros non-modular #25345
Labels
A-hygiene
Area: Macro hygiene
A-lifetimes
Area: Lifetimes / regions
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
non-hygienic lifetime-shadowing check can make macros non-modular
This is sort of related to #24278
Here is some example code (playpen)
This yields the error:
The problem is that there is no way for the macro author to make their macro robust against all possible contexts here. In other words, the referential transparency component of hygiene demands that the lifetimes introduced by an expansion be treated as fresh, but they are not.
(Of course, there are plenty of other ways that our macro system is not hygienic, so this is likely to be filed away as a known weakness in
macro_rules!
. I just wanted to have a place to reference this problem.)The text was updated successfully, but these errors were encountered: