@@ -975,41 +975,74 @@ pub trait PointerLike {}
975975/// that all fields are also `ConstParamTy`, which implies that recursively, all fields 
976976/// are `StructuralPartialEq`. 
977977#[ lang = "const_param_ty" ]  
978- #[ unstable( feature = "adt_const_params " ,  issue = "95174" ) ]  
978+ #[ unstable( feature = "unsized_const_params " ,  issue = "95174" ) ]  
979979#[ diagnostic:: on_unimplemented( message = "`{Self}` can't be used as a const parameter type" ) ]  
980980#[ allow( multiple_supertrait_upcastable) ]  
981- pub  trait  ConstParamTy :  StructuralPartialEq  + Eq  { } 
981+ // We name this differently than the derive macro so that the `adt_const_params` can 
982+ // be used independently of `unsized_const_params` without requiring a full path 
983+ // to the derive macro every time it is used. This should be renamed on stabilization. 
984+ pub  trait  ConstParamTy_ :  UnsizedConstParamTy  + StructuralPartialEq  + Eq  { } 
982985
983986/// Derive macro generating an impl of the trait `ConstParamTy`. 
984987#[ rustc_builtin_macro]  
988+ #[ allow_internal_unstable( unsized_const_params) ]  
985989#[ unstable( feature = "adt_const_params" ,  issue = "95174" ) ]  
986990pub  macro ConstParamTy ( $item: item) { 
987991    /* compiler built-in */ 
988992} 
989993
994+ #[ cfg_attr( not( bootstrap) ,  lang = "unsized_const_param_ty" ) ]  
995+ #[ unstable( feature = "unsized_const_params" ,  issue = "95174" ) ]  
996+ #[ diagnostic:: on_unimplemented( message = "`{Self}` can't be used as a const parameter type" ) ]  
997+ /// A marker for types which can be used as types of `const` generic parameters. 
998+ /// 
999+ /// Equivalent to [`ConstParamTy_`] except that this is used by 
1000+ /// the `unsized_const_params` to allow for fake unstable impls. 
1001+ pub  trait  UnsizedConstParamTy :  StructuralPartialEq  + Eq  { } 
1002+ 
1003+ /// Derive macro generating an impl of the trait `ConstParamTy`. 
1004+ #[ cfg( not( bootstrap) ) ]  
1005+ #[ cfg_attr( not( bootstrap) ,  rustc_builtin_macro) ]  
1006+ #[ cfg_attr( not( bootstrap) ,  allow_internal_unstable( unsized_const_params) ) ]  
1007+ #[ cfg_attr( not( bootstrap) ,  unstable( feature = "unsized_const_params" ,  issue = "95174" ) ) ]  
1008+ pub  macro UnsizedConstParamTy ( $item: item) { 
1009+     /* compiler built-in */ 
1010+ } 
1011+ 
9901012// FIXME(adt_const_params): handle `ty::FnDef`/`ty::Closure` 
9911013marker_impls !  { 
9921014    #[ unstable( feature = "adt_const_params" ,  issue = "95174" ) ] 
993-     ConstParamTy  for 
1015+     ConstParamTy_  for 
9941016        usize ,  u8 ,  u16 ,  u32 ,  u64 ,  u128 , 
9951017        isize ,  i8 ,  i16 ,  i32 ,  i64 ,  i128 , 
9961018        bool , 
9971019        char , 
9981020        ( ) , 
999-         { T :  ConstParamTy ,  const  N :  usize }  [ T ;  N ] , 
1021+         { T :  ConstParamTy_ ,  const  N :  usize }  [ T ;  N ] , 
1022+ } 
1023+ #[ cfg( bootstrap) ]  
1024+ marker_impls !  { 
1025+     #[ unstable( feature = "adt_const_params" ,  issue = "95174" ) ] 
1026+     ConstParamTy_  for 
1027+         str , 
1028+         { T :  ConstParamTy_ }  [ T ] , 
1029+         { T :  ConstParamTy_  + ?Sized }  & T , 
10001030} 
10011031
1002- #[ unstable( feature = "adt_const_params" ,  issue = "95174" ) ]  
1003- #[ rustc_reservation_impl = "types that are not `Sized` are not supported as the type of a const generic parameter" ]  
1004- impl < T >  ConstParamTy  for  [ T ]  { } 
1005- 
1006- #[ unstable( feature = "adt_const_params" ,  issue = "95174" ) ]  
1007- #[ rustc_reservation_impl = "types that are not `Sized` are not supported as the type of a const generic parameter" ]  
1008- impl  ConstParamTy  for  str  { } 
1032+ marker_impls !  { 
1033+     #[ unstable( feature = "unsized_const_params" ,  issue = "95174" ) ] 
1034+     UnsizedConstParamTy  for 
1035+         usize ,  u8 ,  u16 ,  u32 ,  u64 ,  u128 , 
1036+         isize ,  i8 ,  i16 ,  i32 ,  i64 ,  i128 , 
1037+         bool , 
1038+         char , 
1039+         ( ) , 
1040+         { T :  UnsizedConstParamTy ,  const  N :  usize }  [ T ;  N ] , 
10091041
1010- #[ unstable( feature = "adt_const_params" ,  issue = "95174" ) ]  
1011- #[ rustc_reservation_impl = "references are not supported as the type of a const generic parameter" ]  
1012- impl < T :  ?Sized >  ConstParamTy  for  & T  { } 
1042+         str , 
1043+         { T :  UnsizedConstParamTy }  [ T ] , 
1044+         { T :  UnsizedConstParamTy  + ?Sized }  & T , 
1045+ } 
10131046
10141047/// A common trait implemented by all function pointers. 
10151048#[ unstable(  
0 commit comments