8000 fix: Fix postfix snippets duplicating derefs by ChayimFriedman2 · Pull Request #19764 · rust-lang/rust-analyzer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Fix postfix snippets duplicating derefs #19764

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

Conversation

ChayimFriedman2
Copy link
Contributor
@ChayimFriedman2 ChayimFriedman2 commented May 8, 2025

Fixes #19758.

I'm not entirely sure the found_ref_or_deref check is correct - I think maybe we should remove it - but removing it makes let postfix completions no longer appear (although I suspect this is because we check the grandparent instead of the parent).

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 8, 2025
@Veykril
Copy link
Member
Veykril commented May 8, 2025

I think the proper fix here is to also consider the type adjustments of the receiver. As dbg! for example actually needs make the adjustments (where possible) explicit to be completely correct if I am not mistaken?

@ChayimFriedman2
Copy link
Contributor Author

Adjustments depend on the method invoked, so we cannot know them.

@Veykril
Copy link
Member
Veykril commented May 8, 2025

Oh right, sorry, I meant the adjustments of a parent field access / method call expression in cases like x.$0.foo() -> dbg!(x).foo(), here we need to force the adjustments into the dbg! call to be entirely correct.

But that's a separate concern, mixed up the problems here

@ChayimFriedman2
Copy link
Contributor Author
ChayimFriedman2 commented May 8, 2025

I think this will be pretty hard to achieve because inference is done on expr.MISSING.field, and MISSING isn't a field/method of expr.

@Veykril
Copy link
Member
Veykril commented May 8, 2025

Ye that would require even more speculative execution I think 😬

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 8, 2025
Merged via the queue into rust-lang:master with commit 46a31fe May 8, 2025
14 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the too-many-asterisks-dbg branch May 8, 2025 10:06
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.

dbg! postfix snippet duplicates dereference
3 participants
0