Fix a byte/char confusion issue in the error emitter#44081
Fix a byte/char confusion issue in the error emitter#44081bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
0854250 to
b4b0d3e
Compare
src/librustc_errors/emitter.rs
Outdated
There was a problem hiding this comment.
.chars().take(ann.start_col)?
There was a problem hiding this comment.
Oh right, that's better. Not very familiar with iterator APIs.
|
r? @rkruppe |
|
I don't think @rkruppe can r+? Let me know when this is ready. |
src/librustc_errors/emitter.rs
Outdated
There was a problem hiding this comment.
Wait, why is this collecting to a string?
There was a problem hiding this comment.
You can do the same btw with .all(|c| c.is_whitespace()).
src/librustc_errors/emitter.rs
Outdated
There was a problem hiding this comment.
Why is the byte offset unavailable here? Converting to column should be delayed until the last moment IMO (and should take into account unicode grapheme width).
There was a problem hiding this comment.
@eddyb I'm not sure what you mean but the start_col is given as columns, as per this comment:
rust/src/librustc_errors/snippet.rs
Lines 123 to 124 in 32b50e2
Fixes rust-lang#44078. Fixes rust-lang#44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue rust-lang#44080 doesn't get fixed.
|
r? @eddyb |
|
@bors r+ |
|
📌 Commit 5a71e12 has been approved by |
Fix a byte/char confusion issue in the error emitter Fixes rust-lang#44078. Fixes rust-lang#44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue rust-lang#44080 doesn't get fixed.
|
☀️ Test successful - status-appveyor, status-travis |
Fixes #44078. Fixes #44023.
The start_col member is given in chars, while the code previously assumed it was given in bytes.
The more basic issue #44080 doesn't get fixed.