about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2020-06-13 17:31:48 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2020-06-20 14:34:51 +0100
commit5e8c9f4fae106d0ba836a0268ab4e44c19d63f2a (patch)
treee5157e70a45d37f92b405132c1e66596df71aaac /src
parentdb4826dd6ca48663a0b4c5ab0681258999017c7d (diff)
downloadrust-5e8c9f4fae106d0ba836a0268ab4e44c19d63f2a.tar.gz
rust-5e8c9f4fae106d0ba836a0268ab4e44c19d63f2a.zip
Explain what the substs we're creating are
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/compare_method.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs
index 3a292993e39..4c39b2a3b61 100644
--- a/src/librustc_typeck/check/compare_method.rs
+++ b/src/librustc_typeck/check/compare_method.rs
@@ -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);