Skip to content

Fix missing note of escaping { for braces including whitespaces#157012

Open
Kokoro2336 wants to merge 1 commit into
rust-lang:mainfrom
Kokoro2336:fix/issue-156868
Open

Fix missing note of escaping { for braces including whitespaces#157012
Kokoro2336 wants to merge 1 commit into
rust-lang:mainfrom
Kokoro2336:fix/issue-156868

Conversation

@Kokoro2336
Copy link
Copy Markdown
Contributor

@Kokoro2336 Kokoro2336 commented May 27, 2026

Fixes #156868

Add note of escaping { for braces including whitespaces

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 27, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 27, 2026

r? @Kivooeo

rustbot has assigned @Kivooeo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

@mejrs
Copy link
Copy Markdown
Contributor

mejrs commented May 27, 2026

r? me

@rustbot rustbot assigned mejrs and unassigned Kivooeo May 27, 2026
Copy link
Copy Markdown
Contributor

@mejrs mejrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

white_space_only_arg_spaces is a vec but you never access any of its contents, you only ever check whether it is empty or not. So this feels like it is the wrong approach. You also risk emitting it for {} if the format string is something like { } {}.

We track the spans of all arguments already, so you shouldn't need to make any changes to rustc_parse_format. The argument spans are tracked in the position_span fields/variables.

In short, I suggest the following approach:

  • Drop all changes to rustc_parse_format
  • in format.rs, if an implicit argument is missing check position_span and if it is non-empty, suggest escaping the braces.

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 27, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 27, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Kokoro2336
Copy link
Copy Markdown
Contributor Author

@mejrs Fixed @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unescaped empty braces in format string should suggest escaping them

4 participants