Repository navigation
Conversation
Converting a `proc_macro::Group` kept only its delimiter spans, and
converting back joined them. On stable `Span::join` returns the second
span, so a group that went through moxy covered only its closing
delimiter. Diagnostics on a re-emitted group pointed at that delimiter
(an array literal of the wrong length underlined `]`), and a lint that
reads the source between a keyword and a group, such as clippy's
`suspicious_else_formatting` on `} else {`, read the whole block and
fired on correctly formatted code.
`DelimSpan` now stores the whole group's span next to the delimiter
spans. The `proc_macro` and `proc_macro2` bridges fill it from the
compiler's group span, and `DelimSpan::new` still joins the two
delimiter spans. Three derive error fixtures now underline the whole
node they name instead of its last token, and a trybuild fixture covers
the round trip.
faysou
force-pushed
the
fix-compiler-group-spans
branch
from
November 21, 2026 07:07
3a4807f to
3d9d112
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.
Keep the compiler's whole-group span alongside the opening and closing delimiter spans when converting
proc_macroandproc_macro2groups. The array round-trip regression checks that a diagnostic can highlight the whole group.The proc-macro span and trybuild tests pass.
Related to #25.