Skip to content

keyword-idents-2024 unable to migrate loop labels or lifetimes #125986

Closed
@ehuss

Description

The keyword-idents-2024 lint is not able to catch the use of 'gen used as a lifetime or a label. I believe this is because there is no raw syntax available for lifetimes or labels, and thus no way to make it work on both editions (without choosing a new name). I do not see any discussion of this in rust-lang/rfcs#2151 which introduced raw identifiers.

pub fn label() {
    'gen: loop {
        break 'gen;
    }
}

pub fn lifetime<'gen>() {}

I'm not sure what our options are here. It could just pick some different name. Another option is to punt on automatic migration and just document this limitation.

Preliminary crater found in the following:

fauxgen@0.1.4
juniper_codegen@0.16.0
lrp@0.1.0
coasys_juniper_codegen@0.16.0
darling_core@0.20.9
juniper_codegen_puff@0.16.0-dev

cc #123904 @compiler-errors

Meta

rustc --version --verbose:

rustc 1.80.0-nightly (7c52d2db6 2024-06-03)
binary: rustc
commit-hash: 7c52d2db6348b038276198e88a835125849f322e
commit-date: 2024-06-03
host: aarch64-apple-darwin
release: 1.80.0-nightly
LLVM version: 18.1.6

Tracking issue:

Related:

Metadata

Assignees

No one assigned

    Labels

    A-edition-2024Area: The 2024 editionC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions