@@ -205,6 +205,20 @@ pub trait StructuralPartialEq {
205
205
// Empty.
206
206
}
207
207
208
+ marker_impls ! {
209
+ #[ unstable( feature = "structural_match" , issue = "31434" ) ]
210
+ StructuralPartialEq for
211
+ usize , u8 , u16 , u32 , u64 , u128 ,
212
+ isize , i8 , i16 , i32 , i64 , i128 ,
213
+ bool ,
214
+ char ,
215
+ str /* Technically requires `[u8]: StructuralEq` */ ,
216
+ ( ) ,
217
+ { T , const N : usize } [ T ; N ] ,
218
+ { T } [ T ] ,
219
+ { T : ?Sized } & T ,
220
+ }
221
+
208
222
/// Required trait for constants used in pattern matches.
209
223
///
210
224
/// Any type that derives `Eq` automatically implements this trait, *regardless*
@@ -267,6 +281,7 @@ marker_impls! {
267
281
bool ,
268
282
char ,
269
283
str /* Technically requires `[u8]: StructuralEq` */ ,
284
+ ( ) ,
270
285
{ T , const N : usize } [ T ; N ] ,
271
286
{ T } [ T ] ,
272
287
{ T : ?Sized } & T ,
@@ -974,7 +989,8 @@ pub trait PointerLike {}
974
989
#[ lang = "const_param_ty" ]
975
990
#[ unstable( feature = "adt_const_params" , issue = "95174" ) ]
976
991
#[ rustc_on_unimplemented( message = "`{Self}` can't be used as a const parameter type" ) ]
977
- pub trait ConstParamTy : StructuralEq { }
992
+ #[ allow( multiple_supertrait_upcastable) ]
993
+ pub trait ConstParamTy : StructuralEq + StructuralPartialEq { }
978
994
979
995
/// Derive macro generating an impl of the trait `ConstParamTy`.
980
996
#[ rustc_builtin_macro]
@@ -983,8 +999,7 @@ pub macro ConstParamTy($item:item) {
983
999
/* compiler built-in */
984
1000
}
985
1001
986
- // FIXME(generic_const_parameter_types): handle `ty::FnDef`/`ty::Closure`
987
- // FIXME(generic_const_parameter_types): handle `ty::Tuple`
1002
+ // FIXME(adt_const_params): handle `ty::FnDef`/`ty::Closure`
988
1003
marker_impls ! {
989
1004
#[ unstable( feature = "adt_const_params" , issue = "95174" ) ]
990
1005
ConstParamTy for
@@ -998,6 +1013,11 @@ marker_impls! {
998
1013
{ T : ?Sized + ConstParamTy } & T ,
999
1014
}
1000
1015
1016
+ // FIXME(adt_const_params): Add to marker_impls call above once not in bootstrap
1017
+ #[ unstable( feature = "adt_const_params" , issue = "95174" ) ]
1018
+ #[ cfg( not( bootstrap) ) ]
1019
+ impl ConstParamTy for ( ) { }
1020
+
1001
1021
/// A common trait implemented by all function pointers.
1002
1022
#[ unstable(
1003
1023
feature = "fn_ptr_trait" ,
0 commit comments