@@ -24,7 +24,7 @@ use super::{
24
24
/// Information required for the sound usage of a `MemPlace`.
25
25
pub enum MemPlaceMeta < Tag = ( ) , Id = AllocId > {
26
26
/// The unsized payload (e.g. length for slices or vtable pointer for trait objects).
27
- Unsized ( Scalar < Tag , Id > ) ,
27
+ Meta ( Scalar < Tag , Id > ) ,
28
28
/// `Sized` types or unsized `extern type`
29
29
None ,
30
30
/// The address of this place may not be taken. This protects the `MemPlace` from coming from
@@ -35,17 +35,17 @@ pub enum MemPlaceMeta<Tag = (), Id = AllocId> {
35
35
}
36
36
37
37
impl < Tag , Id > MemPlaceMeta < Tag , Id > {
38
- pub fn unwrap_unsized ( self ) -> Scalar < Tag , Id > {
38
+ pub fn unwrap_meta ( self ) -> Scalar < Tag , Id > {
39
39
match self {
40
- Self :: Unsized ( s) => s,
40
+ Self :: Meta ( s) => s,
41
41
Self :: None | Self :: Poison => {
42
42
bug ! ( "expected wide pointer extra data (e.g. slice length or trait object vtable)" )
43
43
}
44
44
}
45
45
}
46
- fn is_unsized ( self ) -> bool {
46
+ fn has_meta ( self ) -> bool {
47
47
match self {
48
- Self :: Unsized ( _) => true ,
48
+ Self :: Meta ( _) => true ,
49
49
Self :: None | Self :: Poison => false ,
50
50
}
51
51
}
@@ -54,7 +54,7 @@ impl<Tag, Id> MemPlaceMeta<Tag, Id> {
54
54
impl < Tag > MemPlaceMeta < Tag > {
55
55
pub fn erase_tag ( self ) -> MemPlaceMeta < ( ) > {
56
56
match self {
57
- Self :: Unsized ( s) => MemPlaceMeta :: Unsized ( s. erase_tag ( ) ) ,
57
+ Self :: Meta ( s) => MemPlaceMeta :: Meta ( s. erase_tag ( ) ) ,
58
58
Self :: None => MemPlaceMeta :: None ,
59
59
Self :: Poison => MemPlaceMeta :: Poison ,
60
60
}
@@ -154,7 +154,7 @@ impl<Tag> MemPlace<Tag> {
154
154
pub fn to_ref ( self ) -> Immediate < Tag > {
155
155
match self . meta {
156
156
MemPlaceMeta :: None => Immediate :: Scalar ( self . ptr . into ( ) ) ,
157
- MemPlaceMeta :: Unsized ( meta) => Immediate :: ScalarPair ( self . ptr . into ( ) , meta. into ( ) ) ,
157
+ MemPlaceMeta :: Meta ( meta) => Immediate :: ScalarPair ( self . ptr . into ( ) , meta. into ( ) ) ,
158
158
MemPlaceMeta :: Poison => bug ! (
159
159
"MPlaceTy::dangling may never be used to produce a \
160
160
place that will have the address of its pointee taken"
@@ -214,7 +214,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> {
214
214
// We need to consult `meta` metadata
215
215
match self . layout . ty . kind {
216
216
ty:: Slice ( ..) | ty:: Str => {
217
- return self . mplace . meta . unwrap_unsized ( ) . to_machine_usize ( cx) ;
217
+ return self . mplace . meta . unwrap_meta ( ) . to_machine_usize ( cx) ;
218
218
}
219
219
_ => bug ! ( "len not supported on unsized type {:?}" , self . layout. ty) ,
220
220
}
@@ -231,7 +231,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> {
231
231
#[ inline]
232
232
pub ( super ) fn vtable ( self ) -> Scalar < Tag > {
233
233
match self . layout . ty . kind {
234
- ty:: Dynamic ( ..) => self . mplace . meta . unwrap_unsized ( ) ,
234
+ ty:: Dynamic ( ..) => self . mplace . meta . unwrap_meta ( ) ,
235
235
_ => bug ! ( "vtable not supported on type {:?}" , self . layout. ty) ,
236
236
}
237
237
}
@@ -312,7 +312,7 @@ where
312
312
let ( ptr, meta) = match * val {
313
313
Immediate :: Scalar ( ptr) => ( ptr. not_undef ( ) ?, MemPlaceMeta :: None ) ,
314
314
Immediate :: ScalarPair ( ptr, meta) => {
315
- ( ptr. not_undef ( ) ?, MemPlaceMeta :: Unsized ( meta. not_undef ( ) ?) )
315
+ ( ptr. not_undef ( ) ?, MemPlaceMeta :: Meta ( meta. not_undef ( ) ?) )
316
316
}
317
317
} ;
318
318
@@ -354,7 +354,7 @@ where
354
354
) -> InterpResult < ' tcx , Option < Pointer < M :: PointerTag > > > {
355
355
let size = size. unwrap_or_else ( || {
356
356
assert ! ( !place. layout. is_unsized( ) ) ;
357
- assert ! ( !place. meta. is_unsized ( ) ) ;
357
+ assert ! ( !place. meta. has_meta ( ) ) ;
358
358
place. layout . size
359
359
} ) ;
360
360
self . memory . check_ptr_access ( place. ptr , size, place. align )
@@ -505,7 +505,7 @@ where
505
505
ty:: Array ( inner, _) => ( MemPlaceMeta :: None , self . tcx . mk_array ( inner, inner_len) ) ,
506
506
ty:: Slice ( ..) => {
507
507
let len = Scalar :: from_uint ( inner_len, self . pointer_size ( ) ) ;
508
- ( MemPlaceMeta :: Unsized ( len) , base. layout . ty )
508
+ ( MemPlaceMeta :: Meta ( len) , base. layout . ty )
509
509
}
510
510
_ => bug ! ( "cannot subslice non-array type: `{:?}`" , base. layout. ty) ,
511
511
} ;
@@ -519,7 +519,7 @@ where
519
519
variant : VariantIdx ,
520
520
) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
521
521
// Downcasts only change the layout
522
- assert ! ( !base. meta. is_unsized ( ) ) ;
522
+ assert ! ( !base. meta. has_meta ( ) ) ;
523
523
Ok ( MPlaceTy { layout : base. layout . for_variant ( self , variant) , ..base } )
524
524
}
525
525
@@ -1081,7 +1081,7 @@ where
1081
1081
let mplace = MemPlace {
1082
1082
ptr : ptr. into ( ) ,
1083
1083
align : Align :: from_bytes ( 1 ) . unwrap ( ) ,
1084
- meta : MemPlaceMeta :: Unsized ( meta) ,
1084
+ meta : MemPlaceMeta :: Meta ( meta) ,
1085
1085
} ;
1086
1086
1087
1087
let layout = self . layout_of ( self . tcx . mk_static_str ( ) ) . unwrap ( ) ;
0 commit comments