You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #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: #123735
RFC: rust-lang/rfcs#3593
Copy file name to clipboardexpand all lines: compiler/rustc_lint/messages.ftl
+3
Original file line number
Diff line number
Diff line change
@@ -740,6 +740,9 @@ lint_reserved_prefix = prefix `{$prefix}` is unknown
740
740
.label = unknown prefix
741
741
.suggestion = insert whitespace here to avoid this being parsed as a prefix in Rust 2021
742
742
743
+
lint_reserved_string = will be parsed as a guarded string in Rust 2024
744
+
.suggestion = insert whitespace here to avoid this being parsed as a guarded string in Rust 2024
745
+
743
746
lint_shadowed_into_iter =
744
747
this method call resolves to `<&{$target} as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<{$target} as IntoIterator>::into_iter` in Rust {$edition}
745
748
.use_iter_suggestion = use `.iter()` instead of `.into_iter()` to avoid ambiguity
0 commit comments