-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Want better error message for attempted hygiene violation, binding in macro #149604
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-hygieneArea: Macro hygieneArea: Macro hygieneA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-hygieneArea: Macro hygieneArea: Macro hygieneA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Current output
Desired output
Rationale and extra context
See #148580
Other cases
See #148580 in which I first suggested such a hint. The example I gave there https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=1ee109560f0d9e2f216a02e346679f1c binds outside the macro and tries to use from inside. This was implemented in #148612 (thanks @chenyukang !)
However, here we have the binding in the macro, which is also forbidden by hygiene. Apparently the implemnetation in #148612 doesn't cover this case.
Rust Version
Today's nightly on the Rust playground.
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=9fb1d5c7091fc5b8572aa30e9ae2f039
Also locally:
Anything else?
CC @JonathanBrouwer