-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
name-based comparison in new label-shadowing check has likely hygiene issues. #24278
Copy link
Copy link
Open
Labels
A-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, ..)C-bugCategory: This is a bug.Category: This is a bug.P-lowLow priorityLow priorityT-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-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, ..)C-bugCategory: This is a bug.Category: This is a bug.P-lowLow priorityLow priorityT-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.
Spawned off of #24162. Our lifetimes only carry a
Name, not anIdent, which means the comparisons for shadowing are only doing name based comparisons.But macros should be free to introduce labels, and have them be treated as independent due to hygiene.
This bug is believed to only introduce issues where code will cause a warning to be emitted by the new shadowing check when it should be accepted; i.e. there are not any known soundness issues associated with this problem.
(Note: While loop labels themselves are
Idents, much of the syntax system does not treat them the same way it treats "normal" variables with respect to e.g. hygiene. For example thesyntax::visitsystem does not invokevisit_identon loop labels.)