add diagnostic for raw identifiers in format string#115611
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 17, 2023
Hidden character warning
The head ref may contain hidden characters: "format!("{r#ident}")"
Merged
add diagnostic for raw identifiers in format string#115611bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
(rustbot has picked a reviewer for you, use r? to override) |
54acc54 to
d990eee
Compare
compiler-errors
approved these changes
Sep 16, 2023
Contributor
|
@bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 17, 2023
Rollup of 6 pull requests Successful merges: - rust-lang#114965 (Remove Drop impl of mpsc Receiver and (Sync)Sender) - rust-lang#115434 (make `Debug` impl for `ascii::Char` match that of `char`) - rust-lang#115477 (Stabilize the `Saturating` type) - rust-lang#115611 (add diagnostic for raw identifiers in format string) - rust-lang#115654 (improve PassMode docs) - rust-lang#115862 (Migrate `compiler/rustc_hir_typeck/src/callee.rs` to translatable diagnostics) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 17, 2023
Rollup merge of rust-lang#115611 - lukas-code:format!("{r#ident}"), r=compiler-errors add diagnostic for raw identifiers in format string Format strings don't support raw identifiers (e.g. `format!("{r#type}")`), but they do support keywords in the format string directly (e.g. `format!("{type}")`). This PR improves the error output when attempting to use a raw identifier in a format string and adds a machine-applicable suggestion to remove the `r#`. fixes rust-lang#115466
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Format strings don't support raw identifiers (e.g.
format!("{r#type}")), but they do support keywords in the format string directly (e.g.format!("{type}")). This PR improves the error output when attempting to use a raw identifier in a format string and adds a machine-applicable suggestion to remove ther#.fixes #115466