Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove NtIdent and NtLifetime #124256

Merged
merged 2 commits into from
May 14, 2024
Merged

Commits on May 13, 2024

  1. Remove a Span from TokenKind::Interpolated.

    This span records the declaration of the metavariable in the LHS of the macro.
    It's used in a couple of error messages. Unfortunately, it gets in the way of
    the long-term goal of removing `TokenKind::Interpolated`. So this commit
    removes it, which degrades a couple of (obscure) error messages but makes
    things simpler and enables the next commit.
    nnethercote committed May 13, 2024
    Configuration menu
    Copy the full SHA
    9a63a42 View commit details
    Browse the repository at this point in the history
  2. Remove NtIdent and NtLifetime.

    The extra span is now recorded in the new `TokenKind::NtIdent` and
    `TokenKind::NtLifetime`. These both consist of a single token, and so
    there's no operator precedence problems with inserting them directly
    into the token stream.
    
    The other way to do this would be to wrap the ident/lifetime in invisible
    delimiters, but there's a lot of code that assumes an interpolated
    ident/lifetime fits in a single token, and changing all that code to work with
    invisible delimiters would have been a pain. (Maybe it could be done in a
    follow-up.)
    
    This change might not seem like much of a win, but it's a first step toward the
    much bigger and long-desired removal of `Nonterminal` and
    `TokenKind::Interpolated`. That change is big and complex enough that it's
    worth doing this piece separately. (Indeed, this commit is based on part of a
    late commit in rust-lang#114647, a prior attempt at that big and complex change.)
    nnethercote committed May 13, 2024
    Configuration menu
    Copy the full SHA
    95e519e View commit details
    Browse the repository at this point in the history