-
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
Pass correct substs to implements_trait
in incorrect_impls
#11122
Conversation
`Copy<T>` does in fact not exist. The substs on the trait_ref contain the `Self` type of the impl as the first parameter, so passing that to `implements_trait`, which then nicely prepends the `Self` type for us does not end will.
r? @Manishearth (rustbot has picked a reviewer for you, use r? to override) |
@@ -80,9 +76,9 @@ impl LateLintPass<'_> for IncorrectImpls { | |||
&& let Some(copy_def_id) = cx.tcx.get_diagnostic_item(sym::Copy) | |||
&& implements_trait( | |||
cx, | |||
hir_ty_to_ty(cx.tcx, imp.self_ty), | |||
trait_impl.self_ty(), |
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.
I also removed a needless hir_ty_to_ty
here.
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Does not need a backport: The fix that was merged in the Rust repo directly already made it to beta. The only difference is, that the version on beta still uses the |
Copy<T>
does in fact not exist. The substs on the trait_ref contain theSelf
type of the impl as the first parameter, so passing that toimplements_trait
, which then nicely prepends theSelf
type for us does not end will.fixes #11121
The assertions requires debug assertions inside rustc, which is probably why it didn't fire here. I tested the change locally in rust-lang/rust and it did not ICE anymore.
cc @xFrednet @Centri3
changelog: [
incorrect_impls
]: fix confusion about generic parameters