-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Implement raw lifetimes and labels ('r#ident
)
#126452
Conversation
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 ()) {} |
This comment has been minimized.
This comment has been minimized.
Also, this doesn't reserve all prefixed lifetimes -- it just implements |
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 |
r-a and rustfmt changes are required due to changes to lexer and parser, respectively. |
This comment has been minimized.
This comment has been minimized.
@bors try |
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
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
There's a crate that specifically |
FWIW, as documented over https://docs.rs/with_locals/0.3.2/with_locals/index.html#remarks, the
|
@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 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 Thanks in particular to @danielhenrymantilla for being responsive on this and understanding of the situation. |
This comment was marked as outdated.
This comment was marked as outdated.
6a25348
to
8567b59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a very tiny and minor nit, that I'm fine with addressing or leaving it as is :).
r=me once you decide what to do with that.
8567b59
to
b6a86be
Compare
@bors r=spastorino |
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#126452 (Implement raw lifetimes and labels (`'r#ident`)) - rust-lang#129555 (stabilize const_float_bits_conv) - rust-lang#129594 (explain the options bootstrap passes to curl) - rust-lang#129677 (Don't build by-move body when async closure is tainted) - rust-lang#129847 (Do not call query to compute coroutine layout for synthetic body of async closure) - rust-lang#129869 (add a few more crashtests) - rust-lang#130009 (rustdoc-search: allow trailing `Foo ->` arg search) - rust-lang#130046 (str: make as_mut_ptr and as_bytes_mut unstably const) - rust-lang#130047 (Win: Add dbghelp to the list of import libraries) - rust-lang#130059 (Remove the unused `llvm-skip-rebuild` option from x.py) r? `@ghost` `@rustbot` modify labels: rollup
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
…prefixes This corresponds to the changes made in rust-lang/rust#126452
This PR does two things:
'prefix#lt
in edition 2021.'r#async
in edition 2021.This PR additionally extends the
keyword_idents_2024
lint to also check lifetimes.cc @traviscross
r? parser