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: fix panic when extracting struct from enum variant #16396

Merged
merged 3 commits into from Jan 20, 2024

Conversation

Young-Flash
Copy link
Member

it panic at builder.make_mut(segment), where segment is from macro expand. And the usage reference in orginal macro call isn't a PathSegment so we can't update it in apply_references, I can't find a way to deal with it properly so here just filter out the reference in macro. LMK if there are better way to fix this

try to close #16328

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 18, 2024
Comment on lines 418 to 419
let origin_range = sema.original_range(segment.syntax()).range;
if s_range != origin_range {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify this

Suggested change
let origin_range = sema.original_range(segment.syntax()).range;
if s_range != origin_range {
let origin_range = sema.original_range(segment.syntax()).range;
if s_range != reference.range {

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2024
@Veykril
Copy link
Member

Veykril commented Jan 20, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 20, 2024

📌 Commit f9b5e0d has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 20, 2024

⌛ Testing commit f9b5e0d with merge 0c76421...

@bors
Copy link
Collaborator

bors commented Jan 20, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 0c76421 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't resolve SyntaxNodePtr when extracting struct from enum variant
4 participants