fix: reconstruct struct values after destructuring - #23380
Open
efegokdemir wants to merge 1 commit into
Open
efegokdemir wants to merge 1 commit into
efegokdemir wants to merge 1 commit into
Conversation
Contributor
|
Please read and follow our AI policy. |
Author
I opened this PR manually, though AI handled much of the implementation. Is there anything I need to change or do for this PR to comply with your AI policy? |
Contributor
|
I don't know, but:
|
Author
|
I used AI to help polish the wording and formatting of the PR description. I wasn't trying to hide that. If this doesn't align with your policy, I'm happy to close the PR rather than take up more of your time. |
Contributor
|
It indeed does not align with the policy, but closing is not needed. You can just revert to the version without AI editing. |
Author
|
I've rewritten the PR description myself. Thanks for clarifying. |
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.
Summary
This PR updates
destructure_struct_bindingto reconstruct the original struct when it's used after destructuring, rather than replacing those usages withtodo!().The change works for both record and tuple structs. It also handles field name conflicts and preserves the existing fallback for unsupported cases, including references, private fields, and certain borrowing scenarios.
I added regression tests for reconstruction, method calls, name collisions, and fallback behaviour.
This addresses part of #8673. Combining the tuple and struct assists and handling the remaining reconstruction cases are still out of scope.
Testing
ide-assiststests passed (3 ignored).AI assistance
I used ChatGPT extensively while working on the implementation and regression tests.