@@ -24,7 +24,7 @@ use super::{
2424/// Information required for the sound usage of a `MemPlace`.
2525pub enum MemPlaceMeta < Tag = ( ) , Id = AllocId > {
2626 /// The unsized payload (e.g. length for slices or vtable pointer for trait objects).
27- Unsized ( Scalar < Tag , Id > ) ,
27+ Meta ( Scalar < Tag , Id > ) ,
2828 /// `Sized` types or unsized `extern type`
2929 None ,
3030 /// 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> {
3535}
3636
3737impl < Tag , Id > MemPlaceMeta < Tag , Id > {
38- pub fn unwrap_unsized ( self ) -> Scalar < Tag , Id > {
38+ pub fn unwrap_meta ( self ) -> Scalar < Tag , Id > {
3939 match self {
40- Self :: Unsized ( s) => s,
40+ Self :: Meta ( s) => s,
4141 Self :: None | Self :: Poison => {
4242 bug ! ( "expected wide pointer extra data (e.g. slice length or trait object vtable)" )
4343 }
4444 }
4545 }
46- fn is_unsized ( self ) -> bool {
46+ fn has_meta ( self ) -> bool {
4747 match self {
48- Self :: Unsized ( _) => true ,
48+ Self :: Meta ( _) => true ,
4949 Self :: None | Self :: Poison => false ,
5050 }
5151 }
@@ -54,7 +54,7 @@ impl<Tag, Id> MemPlaceMeta<Tag, Id> {
5454impl < Tag > MemPlaceMeta < Tag > {
5555 pub fn erase_tag ( self ) -> MemPlaceMeta < ( ) > {
5656 match self {
57- Self :: Unsized ( s) => MemPlaceMeta :: Unsized ( s. erase_tag ( ) ) ,
57+ Self :: Meta ( s) => MemPlaceMeta :: Meta ( s. erase_tag ( ) ) ,
5858 Self :: None => MemPlaceMeta :: None ,
5959 Self :: Poison => MemPlaceMeta :: Poison ,
6060 }
@@ -154,7 +154,7 @@ impl<Tag> MemPlace<Tag> {
154154 pub fn to_ref ( self ) -> Immediate < Tag > {
155155 match self . meta {
156156 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 ( ) ) ,
158158 MemPlaceMeta :: Poison => bug ! (
159159 "MPlaceTy::dangling may never be used to produce a \
160160 place that will have the address of its pointee taken"
@@ -214,7 +214,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> {
214214 // We need to consult `meta` metadata
215215 match self . layout . ty . kind {
216216 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) ;
218218 }
219219 _ => bug ! ( "len not supported on unsized type {:?}" , self . layout. ty) ,
220220 }
@@ -231,7 +231,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> {
231231 #[ inline]
232232 pub ( super ) fn vtable ( self ) -> Scalar < Tag > {
233233 match self . layout . ty . kind {
234- ty:: Dynamic ( ..) => self . mplace . meta . unwrap_unsized ( ) ,
234+ ty:: Dynamic ( ..) => self . mplace . meta . unwrap_meta ( ) ,
235235 _ => bug ! ( "vtable not supported on type {:?}" , self . layout. ty) ,
236236 }
237237 }
@@ -312,7 +312,7 @@ where
312312 let ( ptr, meta) = match * val {
313313 Immediate :: Scalar ( ptr) => ( ptr. not_undef ( ) ?, MemPlaceMeta :: None ) ,
314314 Immediate :: ScalarPair ( ptr, meta) => {
315- ( ptr. not_undef ( ) ?, MemPlaceMeta :: Unsized ( meta. not_undef ( ) ?) )
315+ ( ptr. not_undef ( ) ?, MemPlaceMeta :: Meta ( meta. not_undef ( ) ?) )
316316 }
317317 } ;
318318
@@ -354,7 +354,7 @@ where
354354 ) -> InterpResult < ' tcx , Option < Pointer < M :: PointerTag > > > {
355355 let size = size. unwrap_or_else ( || {
356356 assert ! ( !place. layout. is_unsized( ) ) ;
357- assert ! ( !place. meta. is_unsized ( ) ) ;
357+ assert ! ( !place. meta. has_meta ( ) ) ;
358358 place. layout . size
359359 } ) ;
360360 self . memory . check_ptr_access ( place. ptr , size, place. align )
@@ -505,7 +505,7 @@ where
505505 ty:: Array ( inner, _) => ( MemPlaceMeta :: None , self . tcx . mk_array ( inner, inner_len) ) ,
506506 ty:: Slice ( ..) => {
507507 let len = Scalar :: from_uint ( inner_len, self . pointer_size ( ) ) ;
508- ( MemPlaceMeta :: Unsized ( len) , base. layout . ty )
508+ ( MemPlaceMeta :: Meta ( len) , base. layout . ty )
509509 }
510510 _ => bug ! ( "cannot subslice non-array type: `{:?}`" , base. layout. ty) ,
511511 } ;
@@ -519,7 +519,7 @@ where
519519 variant : VariantIdx ,
520520 ) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
521521 // Downcasts only change the layout
522- assert ! ( !base. meta. is_unsized ( ) ) ;
522+ assert ! ( !base. meta. has_meta ( ) ) ;
523523 Ok ( MPlaceTy { layout : base. layout . for_variant ( self , variant) , ..base } )
524524 }
525525
@@ -1081,7 +1081,7 @@ where
10811081 let mplace = MemPlace {
10821082 ptr : ptr. into ( ) ,
10831083 align : Align :: from_bytes ( 1 ) . unwrap ( ) ,
1084- meta : MemPlaceMeta :: Unsized ( meta) ,
1084+ meta : MemPlaceMeta :: Meta ( meta) ,
10851085 } ;
10861086
10871087 let layout = self . layout_of ( self . tcx . mk_static_str ( ) ) . unwrap ( ) ;
0 commit comments