fix: avoid panic in struct/tuple assists when macro expands usage twice#22586
Open
Albab-Hasan wants to merge 1 commit into
Open
fix: avoid panic in struct/tuple assists when macro expands usage twice#22586Albab-Hasan wants to merge 1 commit into
Albab-Hasan wants to merge 1 commit into
Conversation
`FindUsages` descends into macro expansions and emits a `FileReference` per expansion site. when a `macro_rules!` macro expands `$e` twice, `destructure_tuple_binding`, `destructure_struct_binding`, `convert_named_struct_to_tuple_struct`, and `convert_tuple_struct_to_named_struct` all processed each ref independently, registering two `replace_all` calls for the same source range. `edit_algo` asserts non-intersecting changes and panics in debug/test builds, silently no-ops in release. fixed by deduplicating refs by source range before processing. fixes rust-lang#22555 fixes rust-lang#22556 fixes rust-lang#22557 fixes rust-lang#22558
76bad11 to
644cba6
Compare
Collaborator
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
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.
FindUsagesdescends into macro expansions and emits aFileReferenceper expansion site. when amacro_rules!macro expands$etwice,destructure_tuple_binding,destructure_struct_binding,convert_named_struct_to_tuple_struct, andconvert_tuple_struct_to_named_structall processed each ref independently. registering tworeplace_allcalls for the same source range.edit_algoasserts non-intersecting changes and panics in debug/test builds. silently no-ops in release. fixed by deduplicating refs by source range before processing.Fixes #22555
Fixes #22556
Fixes #22557
Fixes #22558