Skip to content
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

fix: Preserve comments for extracted block expression in 'extract_function' #16333

Merged
merged 2 commits into from Jan 10, 2024

Conversation

roife
Copy link
Contributor

@roife roife commented Jan 10, 2024

Fix #14371

Preserve comments for extracted block expression in 'extract_function'.

In the original implementation, block.statements() was used to construct a new function, removing the comments within the block. In the updated implementation, we use manual traversal of nodes and hacky_block_expr to generate a new block, thereby preserving the comments.

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

Veykril commented Jan 10, 2024

Ugh yea, this is a clear indicator for why we need to switch our AST trivia model #6584

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 10, 2024

📌 Commit d327f30 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 10, 2024

⌛ Testing commit d327f30 with merge 5871b61...

@bors
Copy link
Collaborator

bors commented Jan 10, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 5871b61 to master...

1 similar comment
@bors
Copy link
Collaborator

bors commented Jan 10, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 5871b61 to master...

@bors bors merged commit 5871b61 into rust-lang:master Jan 10, 2024
10 checks passed
@bors
Copy link
Collaborator

bors commented Jan 10, 2024

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

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.

Extract into function remove comments in the first of blocks
4 participants