Skip to content

Commit a635bf7

Browse files
committed
Revert "alloc: Allow comparing Boxs over different allocators"
This reverts commit 001b081. This change was done as the above commit introduces a regression in type inference. Regression test located at `tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs`
1 parent 3c9a749 commit a635bf7

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

library/alloc/src/boxed.rs

+9-26
Original file line numberDiff line numberDiff line change
@@ -1319,56 +1319,39 @@ impl Clone for Box<str> {
13191319
}
13201320

13211321
#[stable(feature = "rust1", since = "1.0.0")]
1322-
impl<T, A1, A2> PartialEq<Box<T, A2>> for Box<T, A1>
1323-
where
1324-
T: ?Sized + PartialEq,
1325-
A1: Allocator,
1326-
A2: Allocator,
1327-
{
1322+
impl<T: ?Sized + PartialEq, A: Allocator> PartialEq for Box<T, A> {
13281323
#[inline]
1329-
fn eq(&self, other: &Box<T, A2>) -> bool {
1324+
fn eq(&self, other: &Self) -> bool {
13301325
PartialEq::eq(&**self, &**other)
13311326
}
1332-
13331327
#[inline]
1334-
fn ne(&self, other: &Box<T, A2>) -> bool {
1328+
fn ne(&self, other: &Self) -> bool {
13351329
PartialEq::ne(&**self, &**other)
13361330
}
13371331
}
1338-
13391332
#[stable(feature = "rust1", since = "1.0.0")]
1340-
impl<T, A1, A2> PartialOrd<Box<T, A2>> for Box<T, A1>
1341-
where
1342-
T: ?Sized + PartialOrd,
1343-
A1: Allocator,
1344-
A2: Allocator,
1345-
{
1333+
impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for Box<T, A> {
13461334
#[inline]
1347-
fn partial_cmp(&self, other: &Box<T, A2>) -> Option<Ordering> {
1335+
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
13481336
PartialOrd::partial_cmp(&**self, &**other)
13491337
}
1350-
13511338
#[inline]
1352-
fn lt(&self, other: &Box<T, A2>) -> bool {
1339+
fn lt(&self, other: &Self) -> bool {
13531340
PartialOrd::lt(&**self, &**other)
13541341
}
1355-
13561342
#[inline]
1357-
fn le(&self, other: &Box<T, A2>) -> bool {
1343+
fn le(&self, other: &Self) -> bool {
13581344
PartialOrd::le(&**self, &**other)
13591345
}
1360-
13611346
#[inline]
1362-
fn ge(&self, other: &Box<T, A2>) -> bool {
1347+
fn ge(&self, other: &Self) -> bool {
13631348
PartialOrd::ge(&**self, &**other)
13641349
}
1365-
13661350
#[inline]
1367-
fn gt(&self, other: &Box<T, A2>) -> bool {
1351+
fn gt(&self, other: &Self) -> bool {
13681352
PartialOrd::gt(&**self, &**other)
13691353
}
13701354
}
1371-
13721355
#[stable(feature = "rust1", since = "1.0.0")]
13731356
impl<T: ?Sized + Ord, A: Allocator> Ord for Box<T, A> {
13741357
#[inline]

0 commit comments

Comments
 (0)