refactor: fix bug in comments right before a Use - #1926
Open
ahomescu wants to merge 1 commit into
Open
Conversation
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 01:40
74694e1 to
c890caf
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 01:57
c890caf to
a67f9d6
Compare
ahomescu
changed the base branch from
ahomescu/fix_reorganize_definitions/multi_namespace_import_splitting
to
ahomescu/fix_reorganize_definitions/deterministic_externs
July 25, 2026 02:11
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 02:11
a67f9d6 to
8c413df
Compare
ahomescu
changed the base branch from
ahomescu/fix_reorganize_definitions/deterministic_externs
to
ahomescu/fix_reorganize_definitions/compare_extern_fn_sigs
July 25, 2026 02:16
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
2 times, most recently
from
July 25, 2026 02:35
5363886 to
5f41b0c
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 03:17
5f41b0c to
ecd1cf4
Compare
ahomescu
changed the base branch from
ahomescu/fix_reorganize_definitions/compare_extern_fn_sigs
to
ahomescu/fix_reorganize_definitions/widen_matched_defs
July 25, 2026 03:17
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 05:09
ecd1cf4 to
a6456cc
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 05:33
a6456cc to
4d62f14
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 05:41
4d62f14 to
c85f8dc
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 05:42
c85f8dc to
bdeeb18
Compare
ahomescu
changed the base branch from
ahomescu/fix_reorganize_definitions/widen_matched_defs
to
ahomescu/fix_reorganize_definitions/multi_namespace_import_splitting
July 25, 2026 05:47
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 05:47
bdeeb18 to
96a61f2
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 25, 2026 05:59
96a61f2 to
c0c2151
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
3 times, most recently
from
July 25, 2026 06:26
eb58868 to
cc04f4f
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
2 times, most recently
from
July 25, 2026 06:51
e3dc557 to
c51dcef
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 29, 2026 23:18
c51dcef to
0b5b380
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
2 times, most recently
from
July 30, 2026 00:31
218e270 to
2835adb
Compare
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
2 times, most recently
from
July 30, 2026 22:56
cb45e42 to
f1a4052
Compare
Root cause (in `rewrite/base.rs`, not the transform): the `Right`/insert branches of `rewrite_seq` and `rewrite_seq_comma_sep` anchored insertions at the neighbors' raw `splice_span()` boundaries, while the neighbors' own rewrites and deletions claim their *comment-extended* spans (`extend_span_comments`) — so an insertion anchored at the raw start of a commented, rewritten item landed inside that item's claimed region and `cleanup_rewrites` panicked. The insert branches now extend the neighbor anchor spans over comments the same way the delete branch always did, and an insertion at position 0 anchors before the first item's comment-extended span (the sequence's outer span can start inside it). Inserting exactly at the extended start of the next item is safe: `cleanup_rewrites` sorts the insertion ahead of the following rewrite. The regression test keeps the comment attached to the import and so covers this fix too.
ahomescu
force-pushed
the
ahomescu/fix_reorganize_definitions/use_comments
branch
from
July 30, 2026 22:58
f1a4052 to
c0cd6fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause (in
rewrite/base.rs, not the transform): theRight/insert branches ofrewrite_seqandrewrite_seq_comma_sepanchoredinsertions at the neighbors' raw
splice_span()boundaries, while theneighbors' own rewrites and deletions claim their comment-extended spans
(
extend_span_comments) — so an insertion anchored at the raw start of acommented, rewritten item landed inside that item's claimed region and
cleanup_rewritespanicked. The insert branches now extend the neighboranchor spans over comments the same way the delete branch always did, and an
insertion at position 0 anchors before the first item's comment-extended span
(the sequence's outer span can start inside it). Inserting exactly at the
extended start of the next item is safe:
cleanup_rewritessorts theinsertion ahead of the following rewrite. The regression test keeps the
comment attached to the import and so covers this fix too.
Stack created with GitHub Stacks CLI • Give Feedback 💬