Fix incorrect span when using byte-escaped rbrace#103828
Fix incorrect span when using byte-escaped rbrace#103828bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Note: a small check removed here. The lexer will raise "numeric character escape is too short" before we ever get to this code if there aren't three characters following the \.
|
☔ The latest upstream changes (presumably #104138) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Could you elaborate the comment? Notably: what is the index of the Vec?
There was a problem hiding this comment.
Could you comment the individual fields?
What are they: positions? Starting at which point of reference?
There was a problem hiding this comment.
Added some comments.
For what it's worth, I think this could also be refactored to instead have a InnerSpan and a usize, which might make some of the intent more clear.
There was a problem hiding this comment.
Could we wrap all creations of InnerOffset?
There was a problem hiding this comment.
Hmm, not exactly sure what you mean.
Maybe related: a function that gives you both position and width could clean this up
There was a problem hiding this comment.
Could you add a comment: what are the input and output usizes?
Should we introduce some type to differentiate "raw" from "remapped" positions?
There was a problem hiding this comment.
Yes, that should be InnerOffset, my bad.
af0d14c to
4ccc7f3
Compare
4ccc7f3 to
35c7939
Compare
|
Rebased against master. |
|
Thanks @cassaundra. Sorry for the slow review. |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (731e0bf): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. |
…cjgillot Fix incorrect span when using byte-escaped rbrace Fix rust-lang#103826, a format args span issue introduced in rust-lang#102214. The current solution for tracking skipped characters made it so that certain situations were ambiguous enough that the original span couldn't be worked out later. This PR improves on the original solution by keeping track of groups of skipped characters using a map, and fixes the previous bug. See an example of this ambiguity in the [previous PR's discussion](rust-lang#102214 (comment)).
Fix #103826, a format args span issue introduced in #102214.
The current solution for tracking skipped characters made it so that certain situations were ambiguous enough that the original span couldn't be worked out later. This PR improves on the original solution by keeping track of groups of skipped characters using a map, and fixes the previous bug. See an example of this ambiguity in the previous PR's discussion.