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

format macro argument parsing fix #83348

Merged
merged 1 commit into from
Mar 27, 2021
Merged

format macro argument parsing fix #83348

merged 1 commit into from
Mar 27, 2021

Conversation

osa1
Copy link
Contributor

@osa1 osa1 commented Mar 21, 2021

When the character next to {} is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of } to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344


r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 21, 2021
@jackh726
Copy link
Member

r? @jackh726

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 26, 2021

📌 Commit 6c45ebe has been approved by jackh726

@rust-highfive rust-highfive assigned jackh726 and unassigned estebank Mar 26, 2021
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 26, 2021
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes rust-lang#83344

---

r? `@estebank`
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 27, 2021
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes rust-lang#83344

---

r? ``@estebank``
@JohnTitor
Copy link
Member

Failed in rollup: #83545 (comment)
@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 27, 2021
@osa1
Copy link
Contributor Author

osa1 commented Mar 27, 2021

This passes the tests locally, and on CI. I don't understand why it failed in the batch merge PR. Any tips?

@JohnTitor
Copy link
Member

@osa1 The auto merge CI run clippy tests but PR's doesn't. You can reproduce the test failure with ./x.py test src/tools/clippy and should bless the output.

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes rust-lang#83344
@osa1
Copy link
Contributor Author

osa1 commented Mar 27, 2021

Thanks @JohnTitor . I updated a clippy test output, we can try this again now.

@JohnTitor
Copy link
Member

Thanks for the update, too! @bors r=jackh726

@bors
Copy link
Contributor

bors commented Mar 27, 2021

📌 Commit 5b9bac2 has been approved by jackh726

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 27, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 27, 2021
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes rust-lang#83344

---

r? `@estebank`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 27, 2021
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes rust-lang#83344

---

r? ``@estebank``
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#79399 (Use detailed and shorter fs error explaination)
 - rust-lang#83348 (format macro argument parsing fix)
 - rust-lang#83462 (ExitStatus: print "exit status: {}" rather than "exit code: {}" on unix)
 - rust-lang#83526 (lazily calls some fns)
 - rust-lang#83558 (Use DebugStruct::finish_non_exhaustive() in std.)
 - rust-lang#83559 (Fix Debug implementation for RwLock{Read,Write}Guard.)
 - rust-lang#83560 (Derive Debug for io::Chain instead of manually implementing it.)
 - rust-lang#83561 (Improve Debug implementations of Mutex and RwLock.)
 - rust-lang#83567 (Update rustup cross-compilation docs link)
 - rust-lang#83569 (Add regression tests for rust-lang#56445)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 973fb4b into rust-lang:master Mar 27, 2021
@rustbot rustbot added this to the 1.53.0 milestone Mar 27, 2021
@osa1 osa1 deleted the issue83344 branch March 27, 2021 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect format string span when specifier is followed by backslash
8 participants