1
Fork 0

Rollup merge of #94689 - compiler-errors:on-unimplemented-substs, r=petrochenkov

Use impl substs in `#[rustc_on_unimplemented]`

We were using the trait-ref substs instead of impl substs in `rustc_on_unimplemented`, even when computing the `rustc_on_unimplemented` attached to an impl block. Let's not do that.

This PR also untangles impl and trait def-ids in the logic in `on_unimplemented` a bit.

Fixes #94675
This commit is contained in:
Dylan DPC 2022-03-08 22:43:56 +01:00 committed by GitHub
commit 568736b98f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 129 additions and 42 deletions

View file

@ -977,7 +977,6 @@ impl<'tcx> TraitRef<'tcx> {
substs: SubstsRef<'tcx>,
) -> ty::TraitRef<'tcx> {
let defs = tcx.generics_of(trait_id);
ty::TraitRef { def_id: trait_id, substs: tcx.intern_substs(&substs[..defs.params.len()]) }
}
}