Implement raw lifetimes and labels ('r#ident) by compiler-errors · Pull Request #126452 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation58 Commits6 Checks6 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

compiler-errors

This PR does two things:

  1. Reserve lifetime prefixes, e.g. 'prefix#lt in edition 2021.
  2. Implements raw lifetimes, e.g. 'r#async in edition 2021.

This PR additionally extends the keyword_idents_2024 lint to also check lifetimes.

cc @traviscross
r? parser

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Jun 14, 2024

@compiler-errors

The only theoretical breakage is this:

macro_rules! lt { ($lt:lifetime # $id:ident) => {} }

lt!('r#a);

edit: whoops, @fmease also notes that it breaks:

#[cfg(any())] fn f<'async>(_: &'async ()) {}

@rust-log-analyzer

This comment has been minimized.

@compiler-errors

Also, this doesn't reserve all prefixed lifetimes -- it just implements 'r#. Not sure if T-lang wants all prefixes to be reserved as well.

@rustbot

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@compiler-errors

r-a and rustfmt changes are required due to changes to lexer and parser, respectively.

ytmimi

@rust-log-analyzer

This comment has been minimized.

fmease

@compiler-errors

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jun 14, 2024

@bors

Implement raw lifetimes and labels ('r#ident)

This PR implements a syntax for raw lifetimes and labels as requested in rust-lang#126335.

This PR also moves keyword lifetime validation (i.e. checking that we don't have something like 'async) from ast validation to the parser, similar to how we handle raw identifiers, since we don't distinguish raw identifiers after parsing.

This PR additionally extends the keyword_idents_2024 lint to also check identifiers.

cc @traviscross r? parser

@bors

☀️ Try build successful - checks-actions
Build commit: d9cbfeb (d9cbfeb054d7bd02cf942e6d32c1c0a91f042ce9)

@compiler-errors

@craterbot

@craterbot

🚧 Experiment pr-126452 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

@compiler-errors

There's a crate that specifically abuses 'ref which is a keyword lifetime. Might have to find a workaround for this.

@danielhenrymantilla

FWIW, as documented over https://docs.rs/with_locals/0.3.2/with_locals/index.html#remarks, the 'ref lifetime choice is just a default one. Users can always provide their own lifetime marker instead. This means that it is possible for users to adjust their code to the change of this PR if needs be.

@traviscross

@rustbot labels -I-lang-nominated

We discussed this in the lang triage call today.

We confirmed that we mean for all prefixed lifetimes to be reserved, not just 'r# ones. We view both the missing reservation and the missing support for 'r# as bug fixes consistent with the intent of RFC 3101. The result of this reservation is that these prefixed lifetimes will be parsed as single tokens rather than as many.

Secondly, we confirmed that we're OK with moving the validation of keywords in lifetimes to pre-expansion from post-expansion. We similarly consider this a bug fix. While the breakage of the convenience feature of the with_locals crate that relies on this is unfortunate, and we wish we had not overlooked this earlier for that reason, we're fortunate that the breakage is contained to only one crate, and we're going to accept this breakage as the extra complexity we'd need to carry in the compiler to work around this isn't deemed worth it.

Thanks in particular to @danielhenrymantilla for being responsive on this and understanding of the situation.

@compiler-errors

@compiler-errors

@compiler-errors

@bors

📌 Commit b6a86be has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Sep 6, 2024

This was referenced

Sep 6, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Sep 7, 2024

@bors

…iaskrgr

Rollup of 10 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Sep 8, 2024

@rust-timer

Rollup merge of rust-lang#126452 - compiler-errors:raw-lifetimes, r=spastorino

Implement raw lifetimes and labels ('r#ident)

This PR does two things:

  1. Reserve lifetime prefixes, e.g. 'prefix#lt in edition 2021.
  2. Implements raw lifetimes, e.g. 'r#async in edition 2021.

This PR additionally extends the keyword_idents_2024 lint to also check lifetimes.

cc @traviscross r? parser

@compiler-errors compiler-errors added the relnotes

Marks issues that should be documented in the release notes of the next release.

label

Sep 8, 2024

mattheww added a commit to mattheww/lexeywan that referenced this pull request

Oct 13, 2024

@mattheww

@ehuss ehuss mentioned this pull request

Oct 30, 2024

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request

Nov 30, 2024

@he32

Pkgsrc changes compared to rust182:

TODO:

Upstream changes:

Version 1.83.0 (2024-11-28)

Language

Compiler

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request

Dec 5, 2024

@tmeijn

This MR contains the following updates:

Package Update Change
rust minor 1.82.0 -> 1.83.0

MR created with the help of el-capitano/tools/renovate-bot.

Proposed changes to behavior should be submitted there as MRs.


Release Notes

rust-lang/rust (rust)

v1.83.0

Compare Source

==========================

Language

Compiler

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.



This MR has been generated by Renovate Bot.

Veykril added a commit to rust-lang/fls that referenced this pull request

Dec 9, 2024

@Veykril

Veykril added a commit to rust-lang/fls that referenced this pull request

Dec 9, 2024

@Veykril

Veykril added a commit to rust-lang/fls that referenced this pull request

Dec 10, 2024

@Veykril

tshepang pushed a commit to ferrocene/ferrocene that referenced this pull request

Dec 18, 2024

@Veykril @tshepang

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request

Feb 24, 2025

@he32

Pkgsrc changes:

Upstream changes:

Version 1.83.0 (2024-11-28)

Language

Compiler

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

Labels

relnotes

Marks issues that should be documented in the release notes of the next release.

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.