Skip to content

Correctly estimate the required space for string in StyledBuffer::prepend #65120

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 8, 2019
Merged

Correctly estimate the required space for string in StyledBuffer::prepend #65120

merged 1 commit into from
Oct 8, 2019

Conversation

AnthonyMikh
Copy link
Contributor

Fix #65119

r? @estebank

`.len()` returns length in bytes so it overestimates the required space
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 5, 2019
@AnthonyMikh
Copy link
Contributor Author

...And let's just hope that it will not introduce one more stable-to-nightly regression.

@estebank
Copy link
Contributor

estebank commented Oct 5, 2019

r=me after testing locally against the three cases requested.

@AnthonyMikh
Copy link
Contributor Author

With combining character:

$ build/x86_64-unknown-linux-gnu/stage2/bin/rustc ../ã.rs --error-format=short
../ã.rs:2:14: error: unterminated double quote string
error: aborting due to previous error

With zero width character (there is a zero-width non-joiner between no and join):

$ build/x86_64-unknown-linux-gnu/stage2/bin/rustc ../no‌join.rs --error-format=short
../no‌join.rs:2:14: error: unterminated double quote string
error: aborting due to previous error

With full-width characters:

$ build/x86_64-unknown-linux-gnu/stage2/bin/rustc '../full _width.rs' --error-format=short
../full_width.rs:2:14: error: unterminated double quote string
error: aborting due to previous error

With example from Manish's blog:

$ build/x86_64-unknown-linux-gnu/stage2/bin/rustc ../ᄀᄀᄀ각ᆨᆨ.rs --error-format=short
error: couldn't read ../ᄀᄀᄀ각ᆨᆨ.rs: No such file or directory (os error 2)
error: aborting due to previous error

Kudos to @kpp for actually carrying out the check.

@estebank
Copy link
Contributor

estebank commented Oct 7, 2019

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 7, 2019

📌 Commit 4414068 has been approved by estebank

@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 Oct 7, 2019
Centril added a commit to Centril/rust that referenced this pull request Oct 7, 2019
Correctly estimate the required space for string in `StyledBuffer::prepend`

Fix rust-lang#65119

r? @estebank
Centril added a commit to Centril/rust that referenced this pull request Oct 8, 2019
Correctly estimate the required space for string in `StyledBuffer::prepend`

Fix rust-lang#65119

r? @estebank
Centril added a commit to Centril/rust that referenced this pull request Oct 8, 2019
Correctly estimate the required space for string in `StyledBuffer::prepend`

Fix rust-lang#65119

r? @estebank
bors added a commit that referenced this pull request Oct 8, 2019
Rollup of 8 pull requests

Successful merges:

 - #64404 (Add long error explanation for E0495)
 - #64918 (Add long error explanation for E0551)
 - #65102 (Disable stack probe when thread sanitizer is enabled)
 - #65120 (Correctly estimate the required space for string in `StyledBuffer::prepend`)
 - #65145 (When suggesting assoc function with type params, include turbofish)
 - #65162 (Remove loaded_from_cache map from DepGraph)
 - #65176 (Remove query-related macros)
 - #65179 (Add long error explanation for E0567)

Failed merges:

r? @ghost
@bors bors merged commit 4414068 into rust-lang:master Oct 8, 2019
# for free to join this conversation on GitHub. Already have an account? # 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.

Compiling a file with a non-ASCII name with --error-format=short enabled makes error messages contain excessive spaces after "filename:line:column"
4 participants