@@ -29,6 +29,7 @@ mod bytewise;
2929pub ( crate ) use bytewise:: BytewiseEq ;
3030
3131use self :: Ordering :: * ;
32+ use crate :: marker:: PointeeSized ;
3233use crate :: ops:: ControlFlow ;
3334
3435/// Trait for comparisons using the equality operator.
@@ -246,7 +247,7 @@ use crate::ops::ControlFlow;
246247 append_const_msg
247248) ]
248249#[ rustc_diagnostic_item = "PartialEq" ]
249- pub trait PartialEq < Rhs : ? Sized = Self > {
250+ pub trait PartialEq < Rhs : PointeeSized = Self > : PointeeSized {
250251 /// Tests for `self` and `other` values to be equal, and is used by `==`.
251252 #[ must_use]
252253 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -332,7 +333,7 @@ pub macro PartialEq($item:item) {
332333#[ doc( alias = "!=" ) ]
333334#[ stable( feature = "rust1" , since = "1.0.0" ) ]
334335#[ rustc_diagnostic_item = "Eq" ]
335- pub trait Eq : PartialEq < Self > {
336+ pub trait Eq : PartialEq < Self > + PointeeSized {
336337 // this method is used solely by `impl Eq or #[derive(Eq)]` to assert that every component of a
337338 // type implements `Eq` itself. The current deriving infrastructure means doing this assertion
338339 // without using a method on this trait is nearly impossible.
@@ -361,7 +362,7 @@ pub macro Eq($item:item) {
361362#[ doc( hidden) ]
362363#[ allow( missing_debug_implementations) ]
363364#[ 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 > {
365366 _field : crate :: marker:: PhantomData < T > ,
366367}
367368
@@ -954,7 +955,7 @@ impl<T: Clone> Clone for Reverse<T> {
954955#[ doc( alias = ">=" ) ]
955956#[ stable( feature = "rust1" , since = "1.0.0" ) ]
956957#[ rustc_diagnostic_item = "Ord" ]
957- pub trait Ord : Eq + PartialOrd < Self > {
958+ pub trait Ord : Eq + PartialOrd < Self > + PointeeSized {
958959 /// This method returns an [`Ordering`] between `self` and `other`.
959960 ///
960961 /// By convention, `self.cmp(&other)` returns the ordering matching the expression
@@ -1337,7 +1338,8 @@ pub macro Ord($item:item) {
13371338 append_const_msg
13381339) ]
13391340#[ 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 {
13411343 /// This method returns an ordering between `self` and `other` values if one exists.
13421344 ///
13431345 /// # Examples
@@ -1481,7 +1483,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
14811483 }
14821484}
14831485
1484- fn default_chaining_impl < T : ? Sized , U : ? Sized > (
1486+ fn default_chaining_impl < T : PointeeSized , U : PointeeSized > (
14851487 lhs : & T ,
14861488 rhs : & U ,
14871489 p : impl FnOnce ( Ordering ) -> bool ,
@@ -1803,6 +1805,7 @@ where
18031805mod impls {
18041806 use crate :: cmp:: Ordering :: { self , Equal , Greater , Less } ;
18051807 use crate :: hint:: unreachable_unchecked;
1808+ use crate :: marker:: PointeeSized ;
18061809 use crate :: ops:: ControlFlow :: { self , Break , Continue } ;
18071810
18081811 macro_rules! partial_eq_impl {
@@ -2015,7 +2018,7 @@ mod impls {
20152018 // & pointers
20162019
20172020 #[ 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
20192022 where
20202023 A : PartialEq < B > ,
20212024 {
@@ -2029,7 +2032,7 @@ mod impls {
20292032 }
20302033 }
20312034 #[ 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
20332036 where
20342037 A : PartialOrd < B > ,
20352038 {
@@ -2071,7 +2074,7 @@ mod impls {
20712074 }
20722075 }
20732076 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2074- impl < A : ? Sized > Ord for & A
2077+ impl < A : PointeeSized > Ord for & A
20752078 where
20762079 A : Ord ,
20772080 {
@@ -2081,12 +2084,12 @@ mod impls {
20812084 }
20822085 }
20832086 #[ 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 { }
20852088
20862089 // &mut pointers
20872090
20882091 #[ 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
20902093 where
20912094 A : PartialEq < B > ,
20922095 {
@@ -2100,7 +2103,7 @@ mod impls {
21002103 }
21012104 }
21022105 #[ 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
21042107 where
21052108 A : PartialOrd < B > ,
21062109 {
@@ -2142,7 +2145,7 @@ mod impls {
21422145 }
21432146 }
21442147 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2145- impl < A : ? Sized > Ord for & mut A
2148+ impl < A : PointeeSized > Ord for & mut A
21462149 where
21472150 A : Ord ,
21482151 {
@@ -2152,10 +2155,10 @@ mod impls {
21522155 }
21532156 }
21542157 #[ 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 { }
21562159
21572160 #[ 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
21592162 where
21602163 A : PartialEq < B > ,
21612164 {
@@ -2170,7 +2173,7 @@ mod impls {
21702173 }
21712174
21722175 #[ 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
21742177 where
21752178 A : PartialEq < B > ,
21762179 {
0 commit comments