-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc: added a check for builtin bounds to vtable search #13228
Conversation
@@ -124,6 +126,26 @@ fn lookup_vtables_for_param(vcx: &VtableContext, | |||
is_early: bool) -> vtable_param_res { | |||
let tcx = vcx.tcx(); | |||
|
|||
if !type_param_bounds.builtin_bounds.is_empty() { | |||
match fixup_ty(vcx, span, ty, is_early) { |
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.
Although, I expect this to break with the opt-in work. Would you mind adding a FIXME(#13231)
so that I remember to update this code once the new opt-in work is done?
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.
Done.
This looks quite good. The fix will have to be updated by the opt-in bound traits work. |
// implementation of a trait | ||
|
||
trait A {} | ||
impl<T: 'static> A for T {} |
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.
Could you please extend this test for other built-in bounds too?
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.
Done as well. I've also added a couple of positive test cases - to make sure opt-in changes don't break them.
There wasn't a check for builtin bounds when looking up vtables, only for trait bounds. This led to types sometimes implementing traits they shouldn't have been able to. Closes #10751
This is now failing for me because of some DST changes. Considering that opt-in built-in traits are probably just around the corner now, i'm closing this for now and will re-open with a rebase when opt-in stuff lands (if these changes will still be needed then). |
Move reference imports filtering into to_proto layer Follow up to rust-lang/rust-analyzer#13186
There wasn't a check for builtin bounds when looking up vtables, only for trait bounds. This led to types sometimes implementing traits they shouldn't have been able to.
Closes #10751