Skip to content

Commit 6bac257

Browse files
Generalize trait impls
1 parent a1849b8 commit 6bac257

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

library/core/src/sync/exclusive.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,13 @@ where
265265
impl<T> Copy for Exclusive<T> where T: Sync + Copy {}
266266

267267
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
268-
impl<T> PartialEq for Exclusive<T>
268+
impl<T, U> PartialEq<Exclusive<U>> for Exclusive<T>
269269
where
270-
T: Sync + PartialEq + ?Sized,
270+
T: Sync + PartialEq<U> + ?Sized,
271+
U: Sync + ?Sized,
271272
{
272273
#[inline]
273-
fn eq(&self, other: &Self) -> bool {
274+
fn eq(&self, other: &Exclusive<U>) -> bool {
274275
self.inner == other.inner
275276
}
276277
}
@@ -293,12 +294,13 @@ where
293294
}
294295

295296
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
296-
impl<T> PartialOrd for Exclusive<T>
297+
impl<T, U> PartialOrd<Exclusive<U>> for Exclusive<T>
297298
where
298-
T: Sync + PartialOrd + ?Sized,
299+
T: Sync + PartialOrd<U> + ?Sized,
300+
U: Sync + ?Sized,
299301
{
300302
#[inline]
301-
fn partial_cmp(&self, other: &Exclusive<T>) -> Option<Ordering> {
303+
fn partial_cmp(&self, other: &Exclusive<U>) -> Option<Ordering> {
302304
self.inner.partial_cmp(&other.inner)
303305
}
304306
}

0 commit comments

Comments
 (0)