Skip to content

Pass correct substs to implements_trait in incorrect_impls#11122

Merged
bors merged 1 commit into
rust-lang:masterfrom
Noratrieb:SUBSTITUTION-INITIATED
Jul 7, 2023
Merged

Pass correct substs to implements_trait in incorrect_impls#11122
bors merged 1 commit into
rust-lang:masterfrom
Noratrieb:SUBSTITUTION-INITIATED

Conversation

@Noratrieb

Copy link
Copy Markdown
Member

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.

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

`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.
@rustbot

rustbot commented Jul 7, 2023

Copy link
Copy Markdown
Collaborator

r? @Manishearth

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 7, 2023
&& implements_trait(
cx,
hir_ty_to_ty(cx.tcx, imp.self_ty),
trait_impl.self_ty(),

Copy link
Copy Markdown
Member Author

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.

@flip1995

flip1995 commented Jul 7, 2023

Copy link
Copy Markdown
Member

@bors r+

Thanks!

@bors

bors commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

📌 Commit 5df1f66 has been approved by flip1995

It is now in the queue for this repository.

@bors

bors commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

⌛ Testing commit 5df1f66 with merge 2eff2f2...

@bors

bors commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 2eff2f2 to master...

@bors bors merged commit 2eff2f2 into rust-lang:master Jul 7, 2023
@Noratrieb Noratrieb deleted the SUBSTITUTION-INITIATED branch July 7, 2023 19:27
@xFrednet xFrednet added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 7, 2023
@flip1995

Copy link
Copy Markdown
Member

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 hir_ty_to_ty function. But this shouldn't be a problem.

@flip1995 flip1995 removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 17, 2023
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.

wrong number of generic parameters for DefId(2:2695 ~ core[747e]::marker::Copy): [Bad, Bad]

6 participants