Skip to content

Commit

Permalink
Explain what the substs we're creating are
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Jun 20, 2020
1 parent db4826d commit 5e8c9f4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/librustc_typeck/check/compare_method.rs
Expand Up @@ -1198,6 +1198,15 @@ fn compare_projection_bounds<'tcx>(

let param_env = tcx.param_env(impl_ty.def_id);

// Given
//
// impl<A, B> Foo<u32> for (A, B) {
// type Bar<C> =...
// }
//
// - `impl_substs` would be `[A, B, C]`
// - `rebased_substs` would be `[(A, B), u32, C]`, combining the substs from
// the *trait* with the generic associated type parameters.
let impl_ty_substs = InternalSubsts::identity_for_item(tcx, impl_ty.def_id);
let rebased_substs =
impl_ty_substs.rebase_onto(tcx, impl_ty.container.id(), impl_trait_ref.substs);
Expand Down

0 comments on commit 5e8c9f4

Please sign in to comment.