Reject raw lifetime followed by `'`, like regular lifetimes do by compiler-errors · Pull Request #132341 · rust-lang/rust
marked this pull request as ready for review
rustbot
added
S-waiting-on-review
labels
Oct 30, 2024
compiler-errors
changed the title
Reject raw lifetime followed by
Reject raw lifetime followed by ' like lifetimes', like regular lifetimes do
joshtriplett
added
T-lang
and removed T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.labels
Oct 30, 2024
joshtriplett
added
the
T-compiler
label
Oct 30, 2024
bors
added
the
S-waiting-on-bors
label
Nov 9, 2024rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Nov 9, 2024Rollup merge of rust-lang#132341 - compiler-errors:raw-lt-prefix-id, r=chenyukang Reject raw lifetime followed by `'`, like regular lifetimes do See comment. We want to reject cases like `'r#long'id`, which currently gets interpreted as a raw lifetime (`'r#long`) followed by a lifetime (`'id`). This could have alternative lexes, such as an overlong char literal (`'r#long'`) followed by an identifier (`id`). To avoid committing to this in any case, let's reject the whole thing. `@mattheww,` is this what you were looking for in rust-lang/reference#1603 (comment)? I'd say ignore the details about the specific error message (the fact that this gets reinterpreted as a char literal is 🤷), just that because this causes a lexer error we're effectively saving syntactical space like you wanted.
mati865 pushed a commit to mati865/rust that referenced this pull request
Nov 12, 2024…r=chenyukang Reject raw lifetime followed by `'`, like regular lifetimes do See comment. We want to reject cases like `'r#long'id`, which currently gets interpreted as a raw lifetime (`'r#long`) followed by a lifetime (`'id`). This could have alternative lexes, such as an overlong char literal (`'r#long'`) followed by an identifier (`id`). To avoid committing to this in any case, let's reject the whole thing. `@mattheww,` is this what you were looking for in rust-lang/reference#1603 (comment)? I'd say ignore the details about the specific error message (the fact that this gets reinterpreted as a char literal is 🤷), just that because this causes a lexer error we're effectively saving syntactical space like you wanted.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Dec 1, 2024…ebank Only error raw lifetime followed by `\'` in edition 2021+ Fixes rust-lang#133479 cc rust-lang#132341 I think this fixes a purely theoretical regression since it only affects edition 2015 (who is using that?) and only in the very rare case of a raw lifetime followed immediately by a lifetime like `'r#a'r`.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Dec 1, 2024…ebank Only error raw lifetime followed by `\'` in edition 2021+ Fixes rust-lang#133479 cc rust-lang#132341 I think this fixes a purely theoretical regression since it only affects edition 2015 (who is using that?) and only in the very rare case of a raw lifetime followed immediately by a lifetime like `'r#a'r`.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Dec 1, 2024Rollup merge of rust-lang#133482 - compiler-errors:raw-lt-tick, r=estebank Only error raw lifetime followed by `\'` in edition 2021+ Fixes rust-lang#133479 cc rust-lang#132341 I think this fixes a purely theoretical regression since it only affects edition 2015 (who is using that?) and only in the very rare case of a raw lifetime followed immediately by a lifetime like `'r#a'r`.
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