77
77
78
78
pub mod marker {
79
79
// 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
+
80
96
#[ lang = "sized" ]
81
97
#[ fundamental]
82
98
#[ 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 { }
84
103
// endregion:sized
85
104
86
105
// region:send
87
106
pub unsafe auto trait Send { }
88
107
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 { }
91
110
// 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 { }
94
113
// endregion:sync
95
114
// endregion:send
96
115
97
116
// region:sync
98
117
pub unsafe auto trait Sync { }
99
118
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 { }
102
121
// endregion:sync
103
122
104
123
// region:unsize
105
124
#[ lang = "unsize" ]
106
- pub trait Unsize < T : ? Sized > { }
125
+ pub trait Unsize < T : PointeeSized > : PointeeSized { }
107
126
// endregion:unsize
108
127
109
128
// region:unpin
@@ -137,9 +156,9 @@ pub mod marker {
137
156
bool char
138
157
}
139
158
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 { }
143
162
impl Copy for ! { }
144
163
}
145
164
// endregion:copy
@@ -151,7 +170,7 @@ pub mod marker {
151
170
152
171
// region:phantom_data
153
172
#[ lang = "phantom_data" ]
154
- pub struct PhantomData < T : ? Sized > ;
173
+ pub struct PhantomData < T : PointeeSized > ;
155
174
// endregion:phantom_data
156
175
157
176
// region:discriminant
@@ -208,7 +227,7 @@ pub mod default {
208
227
pub mod hash {
209
228
pub trait Hasher { }
210
229
211
- pub trait Hash {
230
+ pub trait Hash : PointeeSized {
212
231
fn hash < H : Hasher > ( & self , state : & mut H ) ;
213
232
}
214
233
@@ -224,7 +243,7 @@ pub mod cell {
224
243
use crate :: mem;
225
244
226
245
#[ lang = "unsafe_cell" ]
227
- pub struct UnsafeCell < T : ? Sized > {
246
+ pub struct UnsafeCell < T : PointeeSized > {
228
247
value : T ,
229
248
}
230
249
@@ -238,7 +257,7 @@ pub mod cell {
238
257
}
239
258
}
240
259
241
- pub struct Cell < T : ? Sized > {
260
+ pub struct Cell < T : PointeeSized > {
242
261
value : UnsafeCell < T > ,
243
262
}
244
263
@@ -357,7 +376,7 @@ pub mod convert {
357
376
// endregion:from
358
377
359
378
// region:as_ref
360
- pub trait AsRef < T : ? Sized > {
379
+ pub trait AsRef < T : PointeeSized > : PointeeSized {
361
380
fn as_ref ( & self ) -> & T ;
362
381
}
363
382
// endregion:as_ref
@@ -370,7 +389,7 @@ pub mod mem {
370
389
// region:manually_drop
371
390
#[ lang = "manually_drop" ]
372
391
#[ repr( transparent) ]
373
- pub struct ManuallyDrop < T : ? Sized > {
392
+ pub struct ManuallyDrop < T : PointeeSized > {
374
393
value : T ,
375
394
}
376
395
@@ -381,7 +400,7 @@ pub mod mem {
381
400
}
382
401
383
402
// region:deref
384
- impl < T : ? Sized > crate :: ops:: Deref for ManuallyDrop < T > {
403
+ impl < T : PointeeSized > crate :: ops:: Deref for ManuallyDrop < T > {
385
404
type Target = T ;
386
405
fn deref ( & self ) -> & T {
387
406
& self . value
@@ -428,7 +447,7 @@ pub mod mem {
428
447
pub mod ptr {
429
448
// region:drop
430
449
#[ 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 ) {
432
451
unsafe { drop_in_place ( to_drop) }
433
452
}
434
453
pub const unsafe fn read < T > ( src : * const T ) -> T {
@@ -444,19 +463,19 @@ pub mod ptr {
444
463
// region:pointee
445
464
#[ lang = "pointee_trait" ]
446
465
#[ rustc_deny_explicit_impl( implement_via_object = false ) ]
447
- pub trait Pointee {
466
+ pub trait Pointee : PointeeSized {
448
467
#[ lang = "metadata_type" ]
449
468
type Metadata : Copy + Send + Sync + Ord + Hash + Unpin ;
450
469
}
451
470
// endregion:pointee
452
471
// region:non_null
453
472
#[ rustc_layout_scalar_valid_range_start( 1 ) ]
454
473
#[ rustc_nonnull_optimization_guaranteed]
455
- pub struct NonNull < T : ? Sized > {
474
+ pub struct NonNull < T : PointeeSized > {
456
475
pointer : * const T ,
457
476
}
458
477
// 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
460
479
T : crate :: marker:: Unsize < U >
461
480
{
462
481
}
@@ -481,59 +500,59 @@ pub mod ops {
481
500
use crate :: marker:: Unsize ;
482
501
483
502
#[ lang = "coerce_unsized" ]
484
- pub trait CoerceUnsized < T : ? Sized > { }
503
+ pub trait CoerceUnsized < T > { }
485
504
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 { }
490
509
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 { }
493
512
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 { }
497
516
}
498
517
pub use self :: unsize:: CoerceUnsized ;
499
518
// endregion:coerce_unsized
500
519
501
520
// region:deref
502
521
mod deref {
503
522
#[ lang = "deref" ]
504
- pub trait Deref {
523
+ pub trait Deref : PointeeSized {
505
524
#[ lang = "deref_target" ]
506
525
type Target : ?Sized ;
507
526
fn deref ( & self ) -> & Self :: Target ;
508
527
}
509
528
510
- impl < T : ? Sized > Deref for & T {
529
+ impl < T : PointeeSized > Deref for & T {
511
530
type Target = T ;
512
531
fn deref ( & self ) -> & T {
513
532
loop { }
514
533
}
515
534
}
516
- impl < T : ? Sized > Deref for & mut T {
535
+ impl < T : PointeeSized > Deref for & mut T {
517
536
type Target = T ;
518
537
fn deref ( & self ) -> & T {
519
538
loop { }
520
539
}
521
540
}
522
541
// region:deref_mut
523
542
#[ lang = "deref_mut" ]
524
- pub trait DerefMut : Deref {
543
+ pub trait DerefMut : Deref + PointeeSized {
525
544
fn deref_mut ( & mut self ) -> & mut Self :: Target ;
526
545
}
527
546
// endregion:deref_mut
528
547
529
548
// region:receiver
530
549
#[ lang = "receiver" ]
531
- pub trait Receiver {
550
+ pub trait Receiver : PointeeSized {
532
551
#[ lang = "receiver_target" ]
533
552
type Target : ?Sized ;
534
553
}
535
554
536
- impl < P : ? Sized , T : ? Sized > Receiver for P
555
+ impl < P : PointeeSized , T : PointeeSized > Receiver for P
537
556
where
538
557
P : Deref < Target = T > ,
539
558
{
@@ -1011,13 +1030,13 @@ pub mod ops {
1011
1030
#[ lang = "dispatch_from_dyn" ]
1012
1031
pub trait DispatchFromDyn < T > { }
1013
1032
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 { }
1015
1034
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 { }
1017
1036
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 { }
1019
1038
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 { }
1021
1040
}
1022
1041
pub use self :: dispatch_from_dyn:: DispatchFromDyn ;
1023
1042
// endregion:dispatch_from_dyn
@@ -1026,14 +1045,14 @@ pub mod ops {
1026
1045
// region:eq
1027
1046
pub mod cmp {
1028
1047
#[ lang = "eq" ]
1029
- pub trait PartialEq < Rhs : ? Sized = Self > {
1048
+ pub trait PartialEq < Rhs : PointeeSized = Self > : PointeeSized {
1030
1049
fn eq ( & self , other : & Rhs ) -> bool ;
1031
1050
fn ne ( & self , other : & Rhs ) -> bool {
1032
1051
!self . eq ( other)
1033
1052
}
1034
1053
}
1035
1054
1036
- pub trait Eq : PartialEq < Self > { }
1055
+ pub trait Eq : PartialEq < Self > + PointeeSized { }
1037
1056
1038
1057
// region:derive
1039
1058
#[ rustc_builtin_macro]
@@ -1044,11 +1063,11 @@ pub mod cmp {
1044
1063
1045
1064
// region:ord
1046
1065
#[ lang = "partial_ord" ]
1047
- pub trait PartialOrd < Rhs : ? Sized = Self > : PartialEq < Rhs > {
1066
+ pub trait PartialOrd < Rhs : PointeeSized = Self > : PartialEq < Rhs > + PointeeSized {
1048
1067
fn partial_cmp ( & self , other : & Rhs ) -> Option < Ordering > ;
1049
1068
}
1050
1069
1051
- pub trait Ord : Eq + PartialOrd < Self > {
1070
+ pub trait Ord : Eq + PartialOrd < Self > + PointeeSized {
1052
1071
fn cmp ( & self , other : & Self ) -> Ordering ;
1053
1072
}
1054
1073
@@ -1106,10 +1125,10 @@ pub mod fmt {
1106
1125
}
1107
1126
}
1108
1127
1109
- pub trait Debug {
1128
+ pub trait Debug : PointeeSized {
1110
1129
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result ;
1111
1130
}
1112
- pub trait Display {
1131
+ pub trait Display : PointeeSized {
1113
1132
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result ;
1114
1133
}
1115
1134
@@ -1268,7 +1287,7 @@ pub mod fmt {
1268
1287
}
1269
1288
}
1270
1289
1271
- impl < T : Debug + ? Sized > Debug for & T {
1290
+ impl < T : Debug + PointeeSized > Debug for & T {
1272
1291
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
1273
1292
( & * * self ) . fmt ( f)
1274
1293
}
@@ -1543,7 +1562,7 @@ pub mod iter {
1543
1562
}
1544
1563
// endregion:iterators
1545
1564
}
1546
- impl < I : Iterator + ? Sized > Iterator for & mut I {
1565
+ impl < I : Iterator + PointeeSized > Iterator for & mut I {
1547
1566
type Item = I :: Item ;
1548
1567
fn next ( & mut self ) -> Option < I :: Item > {
1549
1568
( * * self ) . next ( )
0 commit comments