fix: prevent qualifying parameter names in add_missing_impl_members#21665
Merged
A4-Tacks merged 3 commits intorust-lang:masterfrom Feb 19, 2026
Merged
fix: prevent qualifying parameter names in add_missing_impl_members#21665A4-Tacks merged 3 commits intorust-lang:masterfrom
A4-Tacks merged 3 commits intorust-lang:masterfrom
Conversation
Contributor Author
| hi @ChayimFriedman2 it's done. plz take a look when u free |
A4-Tacks reviewed Feb 19, 2026
| } | ||
| | ||
| // Similarly, modules cannot be used in pattern position. | ||
| if matches!(def, hir::ModuleDef::Module(_)) { |
Member
There was a problem hiding this comment.
Can this filter other definitions? For example, structures or functions?
Contributor Author
There was a problem hiding this comment.
@A4-Tacks got it adding filters for structs, fns, etc. updating the PR shortly.
Member
There was a problem hiding this comment.
Note that in fn foo(Foo: i32) {},
struct Foo {}:Foois the identify patternstruct Foo;:Foorequired the transform (likeconst Foo = ...)
Contributor Author
There was a problem hiding this comment.
that makes perfect sense! unit structs/constants can act as values in patterns, while braced structs act as bindings. I'll make sure the filter handles this distinction. thanks for catching that edge case
Contributor Author
| @A4-Tacks updated with new filters and tests |
A4-Tacks approved these changes Feb 19, 2026
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.
Fixes #21663
What changed:
The path transformation logic was incorrectly qualifying parameter names that matched definitions in scope (e.g.,
ptrbecomingstd::ptr).I updated
transform_ident_patinpath_transform.rsto skip the transformation for non-value definitions (like modules, functions, traits, non-unit structs, and non-unit variants) since they act as bindings in patterns. Valid pattern values (unit structs/variants, constants, and statics) are still transformed correctly.Added a comprehensive test to verify all these edge cases.