7777
7878pub mod marker {
7979 // region:sized
80+ #[ lang = "pointee_sized" ]
81+ #[ fundamental]
82+ #[ rustc_specialization_trait]
83+ #[ rustc_deny_explicit_impl]
84+ #[ rustc_do_not_implement_via_object]
85+ #[ rustc_coinductive]
86+ pub trait PointeeSized { }
87+
88+ #[ lang = "meta_sized" ]
89+ #[ fundamental]
90+ #[ rustc_specialization_trait]
91+ #[ rustc_deny_explicit_impl]
92+ #[ rustc_do_not_implement_via_object]
93+ #[ rustc_coinductive]
94+ pub trait MetaSized : PointeeSized { }
95+
8096 #[ lang = "sized" ]
8197 #[ fundamental]
8298 #[ rustc_specialization_trait]
83- pub trait Sized { }
99+ #[ rustc_deny_explicit_impl]
100+ #[ rustc_do_not_implement_via_object]
101+ #[ rustc_coinductive]
102+ pub trait Sized : MetaSized { }
84103 // endregion:sized
85104
86105 // region:send
87106 pub unsafe auto trait Send { }
88107
89- impl < T : ? Sized > !Send for * const T { }
90- impl < T : ? Sized > !Send for * mut T { }
108+ impl < T : PointeeSized > !Send for * const T { }
109+ impl < T : PointeeSized > !Send for * mut T { }
91110 // region:sync
92- unsafe impl < T : Sync + ? Sized > Send for & T { }
93- unsafe impl < T : Send + ? Sized > Send for & mut T { }
111+ unsafe impl < T : Sync + PointeeSized > Send for & T { }
112+ unsafe impl < T : Send + PointeeSized > Send for & mut T { }
94113 // endregion:sync
95114 // endregion:send
96115
97116 // region:sync
98117 pub unsafe auto trait Sync { }
99118
100- impl < T : ? Sized > !Sync for * const T { }
101- impl < T : ? Sized > !Sync for * mut T { }
119+ impl < T : PointeeSized > !Sync for * const T { }
120+ impl < T : PointeeSized > !Sync for * mut T { }
102121 // endregion:sync
103122
104123 // region:unsize
105124 #[ lang = "unsize" ]
106- pub trait Unsize < T : ? Sized > { }
125+ pub trait Unsize < T : PointeeSized > : PointeeSized { }
107126 // endregion:unsize
108127
109128 // region:unpin
@@ -137,9 +156,9 @@ pub mod marker {
137156 bool char
138157 }
139158
140- impl < T : ? Sized > Copy for * const T { }
141- impl < T : ? Sized > Copy for * mut T { }
142- impl < T : ? Sized > Copy for & T { }
159+ impl < T : PointeeSized > Copy for * const T { }
160+ impl < T : PointeeSized > Copy for * mut T { }
161+ impl < T : PointeeSized > Copy for & T { }
143162 impl Copy for ! { }
144163 }
145164 // endregion:copy
@@ -151,7 +170,7 @@ pub mod marker {
151170
152171 // region:phantom_data
153172 #[ lang = "phantom_data" ]
154- pub struct PhantomData < T : ? Sized > ;
173+ pub struct PhantomData < T : PointeeSized > ;
155174 // endregion:phantom_data
156175
157176 // region:discriminant
@@ -208,7 +227,7 @@ pub mod default {
208227pub mod hash {
209228 pub trait Hasher { }
210229
211- pub trait Hash {
230+ pub trait Hash : PointeeSized {
212231 fn hash < H : Hasher > ( & self , state : & mut H ) ;
213232 }
214233
@@ -224,7 +243,7 @@ pub mod cell {
224243 use crate :: mem;
225244
226245 #[ lang = "unsafe_cell" ]
227- pub struct UnsafeCell < T : ? Sized > {
246+ pub struct UnsafeCell < T : PointeeSized > {
228247 value : T ,
229248 }
230249
@@ -238,7 +257,7 @@ pub mod cell {
238257 }
239258 }
240259
241- pub struct Cell < T : ? Sized > {
260+ pub struct Cell < T : PointeeSized > {
242261 value : UnsafeCell < T > ,
243262 }
244263
@@ -357,7 +376,7 @@ pub mod convert {
357376 // endregion:from
358377
359378 // region:as_ref
360- pub trait AsRef < T : ? Sized > {
379+ pub trait AsRef < T : PointeeSized > : PointeeSized {
361380 fn as_ref ( & self ) -> & T ;
362381 }
363382 // endregion:as_ref
@@ -370,7 +389,7 @@ pub mod mem {
370389 // region:manually_drop
371390 #[ lang = "manually_drop" ]
372391 #[ repr( transparent) ]
373- pub struct ManuallyDrop < T : ? Sized > {
392+ pub struct ManuallyDrop < T : PointeeSized > {
374393 value : T ,
375394 }
376395
@@ -381,7 +400,7 @@ pub mod mem {
381400 }
382401
383402 // region:deref
384- impl < T : ? Sized > crate :: ops:: Deref for ManuallyDrop < T > {
403+ impl < T : PointeeSized > crate :: ops:: Deref for ManuallyDrop < T > {
385404 type Target = T ;
386405 fn deref ( & self ) -> & T {
387406 & self . value
@@ -428,7 +447,7 @@ pub mod mem {
428447pub mod ptr {
429448 // region:drop
430449 #[ lang = "drop_in_place" ]
431- pub unsafe fn drop_in_place < T : ? Sized > ( to_drop : * mut T ) {
450+ pub unsafe fn drop_in_place < T : PointeeSized > ( to_drop : * mut T ) {
432451 unsafe { drop_in_place ( to_drop) }
433452 }
434453 pub const unsafe fn read < T > ( src : * const T ) -> T {
@@ -444,19 +463,19 @@ pub mod ptr {
444463 // region:pointee
445464 #[ lang = "pointee_trait" ]
446465 #[ rustc_deny_explicit_impl( implement_via_object = false ) ]
447- pub trait Pointee {
466+ pub trait Pointee : PointeeSized {
448467 #[ lang = "metadata_type" ]
449468 type Metadata : Copy + Send + Sync + Ord + Hash + Unpin ;
450469 }
451470 // endregion:pointee
452471 // region:non_null
453472 #[ rustc_layout_scalar_valid_range_start( 1 ) ]
454473 #[ rustc_nonnull_optimization_guaranteed]
455- pub struct NonNull < T : ? Sized > {
474+ pub struct NonNull < T : PointeeSized > {
456475 pointer : * const T ,
457476 }
458477 // region:coerce_unsized
459- impl < T : ? Sized , U : ? Sized > crate :: ops:: CoerceUnsized < NonNull < U > > for NonNull < T > where
478+ impl < T : PointeeSized , U : PointeeSized > crate :: ops:: CoerceUnsized < NonNull < U > > for NonNull < T > where
460479 T : crate :: marker:: Unsize < U >
461480 {
462481 }
@@ -481,59 +500,59 @@ pub mod ops {
481500 use crate :: marker:: Unsize ;
482501
483502 #[ lang = "coerce_unsized" ]
484- pub trait CoerceUnsized < T : ? Sized > { }
503+ pub trait CoerceUnsized < T > { }
485504
486- impl < ' a , T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < & ' a mut U > for & ' a mut T { }
487- impl < ' a , ' b : ' a , T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < & ' a U > for & ' b mut T { }
488- impl < ' a , T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < * mut U > for & ' a mut T { }
489- impl < ' a , T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < * const U > for & ' a mut T { }
505+ impl < ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < & ' a mut U > for & ' a mut T { }
506+ impl < ' a , ' b : ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < & ' a U > for & ' b mut T { }
507+ impl < ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < * mut U > for & ' a mut T { }
508+ impl < ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < * const U > for & ' a mut T { }
490509
491- impl < ' a , ' b : ' a , T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < & ' a U > for & ' b T { }
492- impl < ' a , T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < * const U > for & ' a T { }
510+ impl < ' a , ' b : ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < & ' a U > for & ' b T { }
511+ impl < ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < * const U > for & ' a T { }
493512
494- impl < T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < * mut U > for * mut T { }
495- impl < T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < * const U > for * mut T { }
496- impl < T : ? Sized + Unsize < U > , U : ? Sized > CoerceUnsized < * const U > for * const T { }
513+ impl < T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < * mut U > for * mut T { }
514+ impl < T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < * const U > for * mut T { }
515+ impl < T : PointeeSized + Unsize < U > , U : PointeeSized > CoerceUnsized < * const U > for * const T { }
497516 }
498517 pub use self :: unsize:: CoerceUnsized ;
499518 // endregion:coerce_unsized
500519
501520 // region:deref
502521 mod deref {
503522 #[ lang = "deref" ]
504- pub trait Deref {
523+ pub trait Deref : PointeeSized {
505524 #[ lang = "deref_target" ]
506525 type Target : ?Sized ;
507526 fn deref ( & self ) -> & Self :: Target ;
508527 }
509528
510- impl < T : ? Sized > Deref for & T {
529+ impl < T : PointeeSized > Deref for & T {
511530 type Target = T ;
512531 fn deref ( & self ) -> & T {
513532 loop { }
514533 }
515534 }
516- impl < T : ? Sized > Deref for & mut T {
535+ impl < T : PointeeSized > Deref for & mut T {
517536 type Target = T ;
518537 fn deref ( & self ) -> & T {
519538 loop { }
520539 }
521540 }
522541 // region:deref_mut
523542 #[ lang = "deref_mut" ]
524- pub trait DerefMut : Deref {
543+ pub trait DerefMut : Deref + PointeeSized {
525544 fn deref_mut ( & mut self ) -> & mut Self :: Target ;
526545 }
527546 // endregion:deref_mut
528547
529548 // region:receiver
530549 #[ lang = "receiver" ]
531- pub trait Receiver {
550+ pub trait Receiver : PointeeSized {
532551 #[ lang = "receiver_target" ]
533552 type Target : ?Sized ;
534553 }
535554
536- impl < P : ? Sized , T : ? Sized > Receiver for P
555+ impl < P : PointeeSized , T : PointeeSized > Receiver for P
537556 where
538557 P : Deref < Target = T > ,
539558 {
@@ -1011,13 +1030,13 @@ pub mod ops {
10111030 #[ lang = "dispatch_from_dyn" ]
10121031 pub trait DispatchFromDyn < T > { }
10131032
1014- impl < ' a , T : ? Sized + Unsize < U > , U : ? Sized > DispatchFromDyn < & ' a U > for & ' a T { }
1033+ impl < ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > DispatchFromDyn < & ' a U > for & ' a T { }
10151034
1016- impl < ' a , T : ? Sized + Unsize < U > , U : ? Sized > DispatchFromDyn < & ' a mut U > for & ' a mut T { }
1035+ impl < ' a , T : PointeeSized + Unsize < U > , U : PointeeSized > DispatchFromDyn < & ' a mut U > for & ' a mut T { }
10171036
1018- impl < T : ? Sized + Unsize < U > , U : ? Sized > DispatchFromDyn < * const U > for * const T { }
1037+ impl < T : PointeeSized + Unsize < U > , U : PointeeSized > DispatchFromDyn < * const U > for * const T { }
10191038
1020- impl < T : ? Sized + Unsize < U > , U : ? Sized > DispatchFromDyn < * mut U > for * mut T { }
1039+ impl < T : PointeeSized + Unsize < U > , U : PointeeSized > DispatchFromDyn < * mut U > for * mut T { }
10211040 }
10221041 pub use self :: dispatch_from_dyn:: DispatchFromDyn ;
10231042 // endregion:dispatch_from_dyn
@@ -1026,14 +1045,14 @@ pub mod ops {
10261045// region:eq
10271046pub mod cmp {
10281047 #[ lang = "eq" ]
1029- pub trait PartialEq < Rhs : ? Sized = Self > {
1048+ pub trait PartialEq < Rhs : PointeeSized = Self > : PointeeSized {
10301049 fn eq ( & self , other : & Rhs ) -> bool ;
10311050 fn ne ( & self , other : & Rhs ) -> bool {
10321051 !self . eq ( other)
10331052 }
10341053 }
10351054
1036- pub trait Eq : PartialEq < Self > { }
1055+ pub trait Eq : PartialEq < Self > + PointeeSized { }
10371056
10381057 // region:derive
10391058 #[ rustc_builtin_macro]
@@ -1044,11 +1063,11 @@ pub mod cmp {
10441063
10451064 // region:ord
10461065 #[ lang = "partial_ord" ]
1047- pub trait PartialOrd < Rhs : ? Sized = Self > : PartialEq < Rhs > {
1066+ pub trait PartialOrd < Rhs : PointeeSized = Self > : PartialEq < Rhs > + PointeeSized {
10481067 fn partial_cmp ( & self , other : & Rhs ) -> Option < Ordering > ;
10491068 }
10501069
1051- pub trait Ord : Eq + PartialOrd < Self > {
1070+ pub trait Ord : Eq + PartialOrd < Self > + PointeeSized {
10521071 fn cmp ( & self , other : & Self ) -> Ordering ;
10531072 }
10541073
@@ -1106,10 +1125,10 @@ pub mod fmt {
11061125 }
11071126 }
11081127
1109- pub trait Debug {
1128+ pub trait Debug : PointeeSized {
11101129 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result ;
11111130 }
1112- pub trait Display {
1131+ pub trait Display : PointeeSized {
11131132 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result ;
11141133 }
11151134
@@ -1268,7 +1287,7 @@ pub mod fmt {
12681287 }
12691288 }
12701289
1271- impl < T : Debug + ? Sized > Debug for & T {
1290+ impl < T : Debug + PointeeSized > Debug for & T {
12721291 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
12731292 ( & * * self ) . fmt ( f)
12741293 }
@@ -1543,7 +1562,7 @@ pub mod iter {
15431562 }
15441563 // endregion:iterators
15451564 }
1546- impl < I : Iterator + ? Sized > Iterator for & mut I {
1565+ impl < I : Iterator + PointeeSized > Iterator for & mut I {
15471566 type Item = I :: Item ;
15481567 fn next ( & mut self ) -> Option < I :: Item > {
15491568 ( * * self ) . next ( )
0 commit comments