-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: ensure implied bounds from associated types are considered in autocomplete #17270
fix: ensure implied bounds from associated types are considered in autocomplete #17270
Conversation
3b34b97
to
2fef081
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add the reproduction as a test to crates\ide-completion\src\tests\special.rs
or crates\ide-completion\src\tests\expression.rs
@bors delegate+ |
✌️ @davidbarsky, you can now approve this pull request! If @Veykril told you to " |
2fef081
to
f14d862
Compare
Good point! I ended up adding a test in |
☔ The latest upstream changes (presumably #17252) made this pull request unmergeable. Please resolve the merge conflicts. |
f14d862
to
a0d3a81
Compare
@bors retry |
hoisted by my own petard! |
☀️ Test successful - checks-actions |
closes: #16989
rust-analyzer needs to consider implied bounds from associated types in order to get all methods suggestions people expect. A pretty easy way to do that is to keep the
candidate_trait_id
's receiver if it matchesTyFingerprint::Unnameable
. When benchmarking this change, I didn't notice a meaningful difference in autocomplete latency.(
TyFingerprint::Unnameable
corresponds toTyKind::AssociatedType
,TyKind::OpaqueType
,TyKind::FnDef
,TyKind::Closure
,TyKind::Coroutine
, andTyKind::CoroutineWitness
.)