@@ -29,6 +29,7 @@ mod bytewise;
29
29
pub ( crate ) use bytewise:: BytewiseEq ;
30
30
31
31
use self :: Ordering :: * ;
32
+ use crate :: marker:: PointeeSized ;
32
33
use crate :: ops:: ControlFlow ;
33
34
34
35
/// Trait for comparisons using the equality operator.
@@ -246,7 +247,7 @@ use crate::ops::ControlFlow;
246
247
append_const_msg
247
248
) ]
248
249
#[ rustc_diagnostic_item = "PartialEq" ]
249
- pub trait PartialEq < Rhs : ? Sized = Self > {
250
+ pub trait PartialEq < Rhs : PointeeSized = Self > : PointeeSized {
250
251
/// Tests for `self` and `other` values to be equal, and is used by `==`.
251
252
#[ must_use]
252
253
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -332,7 +333,7 @@ pub macro PartialEq($item:item) {
332
333
#[ doc( alias = "!=" ) ]
333
334
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
334
335
#[ rustc_diagnostic_item = "Eq" ]
335
- pub trait Eq : PartialEq < Self > {
336
+ pub trait Eq : PartialEq < Self > + PointeeSized {
336
337
// this method is used solely by `impl Eq or #[derive(Eq)]` to assert that every component of a
337
338
// type implements `Eq` itself. The current deriving infrastructure means doing this assertion
338
339
// without using a method on this trait is nearly impossible.
@@ -361,7 +362,7 @@ pub macro Eq($item:item) {
361
362
#[ doc( hidden) ]
362
363
#[ allow( missing_debug_implementations) ]
363
364
#[ unstable( feature = "derive_eq" , reason = "deriving hack, should not be public" , issue = "none" ) ]
364
- pub struct AssertParamIsEq < T : Eq + ? Sized > {
365
+ pub struct AssertParamIsEq < T : Eq + PointeeSized > {
365
366
_field : crate :: marker:: PhantomData < T > ,
366
367
}
367
368
@@ -954,7 +955,7 @@ impl<T: Clone> Clone for Reverse<T> {
954
955
#[ doc( alias = ">=" ) ]
955
956
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
956
957
#[ rustc_diagnostic_item = "Ord" ]
957
- pub trait Ord : Eq + PartialOrd < Self > {
958
+ pub trait Ord : Eq + PartialOrd < Self > + PointeeSized {
958
959
/// This method returns an [`Ordering`] between `self` and `other`.
959
960
///
960
961
/// By convention, `self.cmp(&other)` returns the ordering matching the expression
@@ -1337,7 +1338,8 @@ pub macro Ord($item:item) {
1337
1338
append_const_msg
1338
1339
) ]
1339
1340
#[ rustc_diagnostic_item = "PartialOrd" ]
1340
- pub trait PartialOrd < Rhs : ?Sized = Self > : PartialEq < Rhs > {
1341
+ #[ allow( multiple_supertrait_upcastable) ] // FIXME(sized_hierarchy): remove this
1342
+ pub trait PartialOrd < Rhs : PointeeSized = Self > : PartialEq < Rhs > + PointeeSized {
1341
1343
/// This method returns an ordering between `self` and `other` values if one exists.
1342
1344
///
1343
1345
/// # Examples
@@ -1481,7 +1483,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
1481
1483
}
1482
1484
}
1483
1485
1484
- fn default_chaining_impl < T : ? Sized , U : ? Sized > (
1486
+ fn default_chaining_impl < T : PointeeSized , U : PointeeSized > (
1485
1487
lhs : & T ,
1486
1488
rhs : & U ,
1487
1489
p : impl FnOnce ( Ordering ) -> bool ,
@@ -1803,6 +1805,7 @@ where
1803
1805
mod impls {
1804
1806
use crate :: cmp:: Ordering :: { self , Equal , Greater , Less } ;
1805
1807
use crate :: hint:: unreachable_unchecked;
1808
+ use crate :: marker:: PointeeSized ;
1806
1809
use crate :: ops:: ControlFlow :: { self , Break , Continue } ;
1807
1810
1808
1811
macro_rules! partial_eq_impl {
@@ -2015,7 +2018,7 @@ mod impls {
2015
2018
// & pointers
2016
2019
2017
2020
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2018
- impl < A : ? Sized , B : ? Sized > PartialEq < & B > for & A
2021
+ impl < A : PointeeSized , B : PointeeSized > PartialEq < & B > for & A
2019
2022
where
2020
2023
A : PartialEq < B > ,
2021
2024
{
@@ -2029,7 +2032,7 @@ mod impls {
2029
2032
}
2030
2033
}
2031
2034
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2032
- impl < A : ? Sized , B : ? Sized > PartialOrd < & B > for & A
2035
+ impl < A : PointeeSized , B : PointeeSized > PartialOrd < & B > for & A
2033
2036
where
2034
2037
A : PartialOrd < B > ,
2035
2038
{
@@ -2071,7 +2074,7 @@ mod impls {
2071
2074
}
2072
2075
}
2073
2076
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2074
- impl < A : ? Sized > Ord for & A
2077
+ impl < A : PointeeSized > Ord for & A
2075
2078
where
2076
2079
A : Ord ,
2077
2080
{
@@ -2081,12 +2084,12 @@ mod impls {
2081
2084
}
2082
2085
}
2083
2086
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2084
- impl < A : ? Sized > Eq for & A where A : Eq { }
2087
+ impl < A : PointeeSized > Eq for & A where A : Eq { }
2085
2088
2086
2089
// &mut pointers
2087
2090
2088
2091
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2089
- impl < A : ? Sized , B : ? Sized > PartialEq < & mut B > for & mut A
2092
+ impl < A : PointeeSized , B : PointeeSized > PartialEq < & mut B > for & mut A
2090
2093
where
2091
2094
A : PartialEq < B > ,
2092
2095
{
@@ -2100,7 +2103,7 @@ mod impls {
2100
2103
}
2101
2104
}
2102
2105
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2103
- impl < A : ? Sized , B : ? Sized > PartialOrd < & mut B > for & mut A
2106
+ impl < A : PointeeSized , B : PointeeSized > PartialOrd < & mut B > for & mut A
2104
2107
where
2105
2108
A : PartialOrd < B > ,
2106
2109
{
@@ -2142,7 +2145,7 @@ mod impls {
2142
2145
}
2143
2146
}
2144
2147
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2145
- impl < A : ? Sized > Ord for & mut A
2148
+ impl < A : PointeeSized > Ord for & mut A
2146
2149
where
2147
2150
A : Ord ,
2148
2151
{
@@ -2152,10 +2155,10 @@ mod impls {
2152
2155
}
2153
2156
}
2154
2157
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2155
- impl < A : ? Sized > Eq for & mut A where A : Eq { }
2158
+ impl < A : PointeeSized > Eq for & mut A where A : Eq { }
2156
2159
2157
2160
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2158
- impl < A : ? Sized , B : ? Sized > PartialEq < & mut B > for & A
2161
+ impl < A : PointeeSized , B : PointeeSized > PartialEq < & mut B > for & A
2159
2162
where
2160
2163
A : PartialEq < B > ,
2161
2164
{
@@ -2170,7 +2173,7 @@ mod impls {
2170
2173
}
2171
2174
2172
2175
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2173
- impl < A : ? Sized , B : ? Sized > PartialEq < & B > for & mut A
2176
+ impl < A : PointeeSized , B : PointeeSized > PartialEq < & B > for & mut A
2174
2177
where
2175
2178
A : PartialEq < B > ,
2176
2179
{
0 commit comments