Skip to content

name-based comparison in new label-shadowing check has likely hygiene issues. #24278

Open
@pnkfelix

Description

@pnkfelix

Spawned off of #24162. Our lifetimes only carry a Name, not an Ident, 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 the syntax::visit system does not invoke visit_ident on loop labels.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-hygieneArea: Macro hygieneA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions