-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: handle trait methods as inherent methods for trait-related types #13147
Conversation
Never mind, I managed to solve the same issue for placeholder types. We should also handle trait methods as inherent if the placeholder type for which we're resolving method is bounded by traits. Although I believe this is the correct fix, please double check; I'm writing the patch as I'm familiarizing myself with how rustc does method resolution. |
Judging from the rust source this looks correct to me, if it breaks anything we can revert it since we just pushed a stable release |
☀️ Test successful - checks-actions |
…hods, r=lnicola Revert "fix: handle trait methods as inherent methods for trait-related types" Reverts #13147 https://github.com/rust-lang/rust-analyzer/actions/runs/3041499441/jobs/4898678721#step:18:62
…hods, r=lnicola fix: Fix a crash introduced in #13147 Reverts #13147 https://github.com/rust-lang/rust-analyzer/actions/runs/3041499441/jobs/4898678721#step:18:62
Fixes #10677
When resolving methods for trait object types and placeholder types that are bounded by traits, we need to count the methods of the trait and its super traits as inherent methods. This matters because these trait methods have higher priority than the other traits' methods.
Relevant code in rustc:
assemble_inherent_candidates_from_object()
for trait object types,assemble_inherent_candidates_from_param()
for placeholder types. Notice the second arg ofpush_candidate()
isis_inherent
.