Skip to content

fix: self type replacement in inline-function #16114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

roife
Copy link
Member

@roife roife commented Dec 13, 2023

Fix #16113, fix #16091

The problem described in this issue actually involves three bugs.

Firstly, when using ted to modify the syntax tree, the offset of nodes on the tree changes, which causes the syntax range information from hir to become invalid. Therefore, we need to edit the AST after the last usage for usages_for_locals.

The second issue is that when inserting nodes, it's necessary to use clone_subtree for duplication because the ted::replace operation essentially moves a node.

The third issue is that we should use ancestors_with_macros instead of ancestors to handle impl definition in macros.

I have fixed the three bugs mentioned above and added unit tests.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 13, 2023
@Veykril
Copy link
Member

Veykril commented Jan 2, 2024

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Jan 2, 2024

📌 Commit 38b5dcb has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 2, 2024

⌛ Testing commit 38b5dcb with merge 306defa...

@bors
Copy link
Contributor

bors commented Jan 2, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 306defa to master...

@bors bors merged commit 306defa into rust-lang:master Jan 2, 2024
@roife roife deleted the fix-inline-with-self-type branch January 2, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inlining functions with Self 'inline function' assist does not take as Self casts into account
4 participants