about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-03-22 04:32:23 +0000
committerMichael Goulet <michael@errs.io>2023-03-22 18:16:01 +0000
commit08284449a24f28ca9d76b8ccd823bc59ed2b30e3 (patch)
treee4ff3b4359f43f86b30fc2ff5ba16c0c1af3f25d
parent6dc3999c2699461aa930b8c1e00f99e73dcc0174 (diff)
downloadrust-08284449a24f28ca9d76b8ccd823bc59ed2b30e3.tar.gz
rust-08284449a24f28ca9d76b8ccd823bc59ed2b30e3.zip
Subst gat normalize pred correctly
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs2
-rw-r--r--tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs17
2 files changed, 18 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index 49665525967..fd89a2067b7 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -1958,7 +1958,7 @@ pub(super) fn check_type_bounds<'tcx>(
     let container_id = impl_ty.container_id(tcx);
 
     let rebased_substs = impl_ty_substs.rebase_onto(tcx, container_id, impl_trait_ref.substs);
-    let impl_ty_value = tcx.type_of(impl_ty.def_id).subst_identity();
+    let impl_ty_value = tcx.type_of(impl_ty.def_id).subst(tcx, impl_ty_substs);
 
     let param_env = tcx.param_env(impl_ty.def_id);
 
diff --git a/tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs b/tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs
new file mode 100644
index 00000000000..b43f982283b
--- /dev/null
+++ b/tests/ui/generic-associated-types/gat-bounds-normalize-pred.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+trait Foo {
+    type Assoc<T>: PartialEq<Self::Assoc<i32>>;
+}
+
+impl Foo for () {
+    type Assoc<T> = Wrapper<T>;
+}
+
+struct Wrapper<T>(T);
+
+impl<T> PartialEq<Wrapper<i32>> for Wrapper<T> {
+    fn eq(&self, _other: &Wrapper<i32>) -> bool { true }
+}
+
+fn main() {}