-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Don't escape unicode escape braces in print_literal
#11265
Conversation
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
258c6d5
to
b1a4236
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok to me, but I'd like to see more tests.
tests/ui/print_literal.rs
Outdated
@@ -42,4 +42,7 @@ fn main() { | |||
// The string literal from `file!()` has a callsite span that isn't marked as coming from an | |||
// expansion | |||
println!("file: {}", file!()); | |||
|
|||
// Braces in unicode escapes should not be escaped | |||
println!("{}", "{} \u{ab123} {}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a test case with a format string of "\\u{ab123}"
with binding of ab123
to something?
Or a test case with additional format arg things like debug output or width specification?
Just to make sure we cover all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\\u{..}
was a good call, it didn't handle that correctly so I've replaced the regex with a state machine
97587e8
to
ec76c7c
Compare
☔ The latest upstream changes (presumably #11239) made this pull request unmergeable. Please resolve the merge conflicts. |
ec76c7c
to
8e3b1a6
Compare
Isn't this PR ready to be merged? |
☔ The latest upstream changes (presumably #11576) made this pull request unmergeable. Please resolve the merge conflicts. |
8e3b1a6
to
9ba8342
Compare
I think another test case with |
9ba8342
to
258b9a8
Compare
Thank you! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #11264
changelog: none