diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 850b25473d6..89d4ad31d1e 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2163,53 +2163,23 @@ impl<'tcx, T: 'tcx + ?Sized> IntoPointer for InternedInSet<'tcx, T> { } #[allow(rustc::usage_of_ty_tykind)] -impl<'tcx> Borrow> for InternedInSet<'tcx, WithCachedTypeInfo>> { - fn borrow<'a>(&'a self) -> &'a TyKind<'tcx> { +impl<'tcx, T> Borrow for InternedInSet<'tcx, WithCachedTypeInfo> { + fn borrow<'a>(&'a self) -> &'a T { &self.0.internee } } -impl<'tcx> PartialEq for InternedInSet<'tcx, WithCachedTypeInfo>> { - fn eq(&self, other: &InternedInSet<'tcx, WithCachedTypeInfo>>) -> bool { +impl<'tcx, T: PartialEq> PartialEq for InternedInSet<'tcx, WithCachedTypeInfo> { + fn eq(&self, other: &InternedInSet<'tcx, WithCachedTypeInfo>) -> bool { // The `Borrow` trait requires that `x.borrow() == y.borrow()` equals // `x == y`. self.0.internee == other.0.internee } } -impl<'tcx> Eq for InternedInSet<'tcx, WithCachedTypeInfo>> {} +impl<'tcx, T: Eq> Eq for InternedInSet<'tcx, WithCachedTypeInfo> {} -impl<'tcx> Hash for InternedInSet<'tcx, WithCachedTypeInfo>> { - fn hash(&self, s: &mut H) { - // The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`. - self.0.internee.hash(s) - } -} - -impl<'tcx> Borrow>> - for InternedInSet<'tcx, WithCachedTypeInfo>>> -{ - fn borrow<'a>(&'a self) -> &'a Binder<'tcx, PredicateKind<'tcx>> { - &self.0.internee - } -} - -impl<'tcx> PartialEq - for InternedInSet<'tcx, WithCachedTypeInfo>>> -{ - fn eq( - &self, - other: &InternedInSet<'tcx, WithCachedTypeInfo>>>, - ) -> bool { - // The `Borrow` trait requires that `x.borrow() == y.borrow()` equals - // `x == y`. - self.0.internee == other.0.internee - } -} - -impl<'tcx> Eq for InternedInSet<'tcx, WithCachedTypeInfo>>> {} - -impl<'tcx> Hash for InternedInSet<'tcx, WithCachedTypeInfo>>> { +impl<'tcx, T: Hash> Hash for InternedInSet<'tcx, WithCachedTypeInfo> { fn hash(&self, s: &mut H) { // The `Borrow` trait requires that `x.borrow().hash(s) == x.hash(s)`. self.0.internee.hash(s)