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

RFC: Reserve unprefixed guarded string literals in Edition 2024 #3593

Merged
merged 2 commits into from
May 6, 2024

Conversation

pitaj
Copy link
Contributor

@pitaj pitaj commented Mar 25, 2024

Beginning with the 2024 edition, reserve the syntax #"foo"#, as a way of future-proofing against future language changes.

Rendered

Note: much of the text of this RFC is directly adapted from #3101. Thank you to @bstrie and all other contributors there for paving the path.

@pitaj

This comment was marked as resolved.

@rustbot rustbot added the T-lang Relevant to the language team, which will review and decide on the RFC. label Mar 25, 2024
@scottmcm scottmcm added the I-lang-nominated Indicates that an issue has been nominated for prioritizing at the next lang team meeting. label Mar 25, 2024
@joshtriplett
Copy link
Member

joshtriplett commented Mar 25, 2024

Very much in favor of reserving this syntax.

Starting an FCP so we can check for consensus asynchronously, in addition to discussing this at a future meeting.

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Mar 25, 2024

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. labels Mar 25, 2024
@rfcbot rfcbot added final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. and removed proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. labels Apr 3, 2024
@rfcbot
Copy link
Collaborator

rfcbot commented Apr 3, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@tmandry
Copy link
Member

tmandry commented Apr 3, 2024

@rfcbot reviewed

It would be nice if we could do a crater run to tell the impact on any macros, but +1 to reserving the syntax in any case.

@traviscross
Copy link
Contributor

@rustbot labels -I-lang-nominated

We discussed this in the meeting on 2024-04-03 and people wanted to see this happen. Thanks to @pitaj for separating this out and putting this forward.

@rustbot rustbot removed the I-lang-nominated Indicates that an issue has been nominated for prioritizing at the next lang team meeting. label Apr 5, 2024
@traviscross traviscross added the A-edition-2024 Area: The 2024 edition label Apr 10, 2024
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this RFC. to-announce and removed final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. labels Apr 13, 2024
@rfcbot
Copy link
Collaborator

rfcbot commented Apr 13, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

The FCP for RFC 3593 has completed, so let's prepare it to be merged.
In this case, that means changing the file name to use dashes rather
than underscores as separators and updating the tracking issue.
@traviscross traviscross merged commit a57b4bc into rust-lang:master May 6, 2024
@traviscross
Copy link
Contributor

The lang team has accepted this RFC, and we've now merged it.

Thanks to @pitaj for pushing this forward, and thanks to all those who reviewed this RFC and provided helpful feedback.

For further updates on this work, follow the tracking issue:

bors added a commit to rust-lang-ci/rust that referenced this pull request May 14, 2024
Experiment: Reserve guarded string literal syntax (RFC 3593) on all editions

Purpose: crater run to see if we even need to make this change on an edition boundary.

This syntax change applies to all editions, because the particular syntax `#"foo"#` is unlikely to exist in the wild.

Subset of rust-lang#123951

Tracking issue: rust-lang#123735
RFC: rust-lang/rfcs#3593
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 9, 2024
…viscross

Reserve guarded string literals (RFC 3593)

Implementation for RFC 3593, including:
- lexer / parser changes
- diagnostics
- migration lint
- tests

We reserve `#"`, `##"`, `###"`, `####`, and any other string of four or more repeated `#`. This avoids infinite lookahead in the lexer, though we still use infinite lookahead in the parser to provide better forward compatibility diagnostics.

This PR does not implement any special lexing of the string internals:
- strings preceded by one or more `#` are denied
- regardless of the number of trailing `#`
- string contents are lexed as if it was just a bare `"string"`

Tracking issue: rust-lang#123735
RFC: rust-lang/rfcs#3593
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 9, 2024
…raviscross

Reserve guarded string literals (RFC 3593)

Implementation for RFC 3593, including:
- lexer / parser changes
- diagnostics
- migration lint
- tests

We reserve `#"`, `##"`, `###"`, `####`, and any other string of four or more repeated `#`. This avoids infinite lookahead in the lexer, though we still use infinite lookahead in the parser to provide better forward compatibility diagnostics.

This PR does not implement any special lexing of the string internals:
- strings preceded by one or more `#` are denied
- regardless of the number of trailing `#`
- string contents are lexed as if it was just a bare `"string"`

Tracking issue: rust-lang#123735
RFC: rust-lang/rfcs#3593
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2024
Rollup merge of rust-lang#123951 - pitaj:reserve-guarded-strings, r=traviscross

Reserve guarded string literals (RFC 3593)

Implementation for RFC 3593, including:
- lexer / parser changes
- diagnostics
- migration lint
- tests

We reserve `#"`, `##"`, `###"`, `####`, and any other string of four or more repeated `#`. This avoids infinite lookahead in the lexer, though we still use infinite lookahead in the parser to provide better forward compatibility diagnostics.

This PR does not implement any special lexing of the string internals:
- strings preceded by one or more `#` are denied
- regardless of the number of trailing `#`
- string contents are lexed as if it was just a bare `"string"`

Tracking issue: rust-lang#123735
RFC: rust-lang/rfcs#3593
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Oct 17, 2024
Reserve guarded string literals (RFC 3593)

Implementation for RFC 3593, including:
- lexer / parser changes
- diagnostics
- migration lint
- tests

We reserve `#"`, `##"`, `###"`, `####`, and any other string of four or more repeated `#`. This avoids infinite lookahead in the lexer, though we still use infinite lookahead in the parser to provide better forward compatibility diagnostics.

This PR does not implement any special lexing of the string internals:
- strings preceded by one or more `#` are denied
- regardless of the number of trailing `#`
- string contents are lexed as if it was just a bare `"string"`

Tracking issue: #123735
RFC: rust-lang/rfcs#3593
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition disposition-merge This RFC is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this RFC. T-lang Relevant to the language team, which will review and decide on the RFC. to-announce
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants