@@ -34,7 +34,7 @@ pub struct MemPlace<Tag=(), Id=AllocId> {
34
34
/// Metadata for unsized places. Interpretation is up to the type.
35
35
/// Must not be present for sized types, but can be missing for unsized types
36
36
/// (e.g. `extern type`).
37
- pub extra : Option < Scalar < Tag , Id > > ,
37
+ pub meta : Option < Scalar < Tag , Id > > ,
38
38
}
39
39
40
40
#[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq ) ]
@@ -97,7 +97,7 @@ impl MemPlace {
97
97
MemPlace {
98
98
ptr : self . ptr . with_default_tag ( ) ,
99
99
align : self . align ,
100
- extra : self . extra . map ( Scalar :: with_default_tag) ,
100
+ meta : self . meta . map ( Scalar :: with_default_tag) ,
101
101
}
102
102
}
103
103
}
@@ -109,7 +109,7 @@ impl<Tag> MemPlace<Tag> {
109
109
MemPlace {
110
110
ptr : self . ptr . erase_tag ( ) ,
111
111
align : self . align ,
112
- extra : self . extra . map ( Scalar :: erase_tag) ,
112
+ meta : self . meta . map ( Scalar :: erase_tag) ,
113
113
}
114
114
}
115
115
@@ -118,7 +118,7 @@ impl<Tag> MemPlace<Tag> {
118
118
MemPlace {
119
119
ptr,
120
120
align,
121
- extra : None ,
121
+ meta : None ,
122
122
}
123
123
}
124
124
@@ -129,11 +129,11 @@ impl<Tag> MemPlace<Tag> {
129
129
130
130
#[ inline( always) ]
131
131
pub fn to_scalar_ptr_align ( self ) -> ( Scalar < Tag > , Align ) {
132
- assert ! ( self . extra . is_none( ) ) ;
132
+ assert ! ( self . meta . is_none( ) ) ;
133
133
( self . ptr , self . align )
134
134
}
135
135
136
- /// Extract the ptr part of the mplace
136
+ /// metact the ptr part of the mplace
137
137
#[ inline( always) ]
138
138
pub fn to_ptr ( self ) -> EvalResult < ' tcx , Pointer < Tag > > {
139
139
// At this point, we forget about the alignment information --
@@ -147,9 +147,9 @@ impl<Tag> MemPlace<Tag> {
147
147
pub fn to_ref ( self ) -> Value < Tag > {
148
148
// We ignore the alignment of the place here -- special handling for packed structs ends
149
149
// at the `&` operator.
150
- match self . extra {
150
+ match self . meta {
151
151
None => Value :: Scalar ( self . ptr . into ( ) ) ,
152
- Some ( extra ) => Value :: ScalarPair ( self . ptr . into ( ) , extra . into ( ) ) ,
152
+ Some ( meta ) => Value :: ScalarPair ( self . ptr . into ( ) , meta . into ( ) ) ,
153
153
}
154
154
}
155
155
}
@@ -175,10 +175,10 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> {
175
175
#[ inline]
176
176
pub ( super ) fn len ( self , cx : impl HasDataLayout ) -> EvalResult < ' tcx , u64 > {
177
177
if self . layout . is_unsized ( ) {
178
- // We need to consult `extra ` metadata
178
+ // We need to consult `meta ` metadata
179
179
match self . layout . ty . sty {
180
180
ty:: Slice ( ..) | ty:: Str =>
181
- return self . mplace . extra . unwrap ( ) . to_usize ( cx) ,
181
+ return self . mplace . meta . unwrap ( ) . to_usize ( cx) ,
182
182
_ => bug ! ( "len not supported on unsized type {:?}" , self . layout. ty) ,
183
183
}
184
184
} else {
@@ -194,7 +194,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> {
194
194
#[ inline]
195
195
pub ( super ) fn vtable ( self ) -> EvalResult < ' tcx , Pointer < Tag > > {
196
196
match self . layout . ty . sty {
197
- ty:: Dynamic ( ..) => self . mplace . extra . unwrap ( ) . to_ptr ( ) ,
197
+ ty:: Dynamic ( ..) => self . mplace . meta . unwrap ( ) . to_ptr ( ) ,
198
198
_ => bug ! ( "vtable not supported on type {:?}" , self . layout. ty) ,
199
199
}
200
200
}
283
283
let align = layout. align ;
284
284
let mplace = match * val {
285
285
Value :: Scalar ( ptr) =>
286
- MemPlace { ptr : ptr. not_undef ( ) ?, align, extra : None } ,
287
- Value :: ScalarPair ( ptr, extra ) =>
288
- MemPlace { ptr : ptr. not_undef ( ) ?, align, extra : Some ( extra . not_undef ( ) ?) } ,
286
+ MemPlace { ptr : ptr. not_undef ( ) ?, align, meta : None } ,
287
+ Value :: ScalarPair ( ptr, meta ) =>
288
+ MemPlace { ptr : ptr. not_undef ( ) ?, align, meta : Some ( meta . not_undef ( ) ?) } ,
289
289
} ;
290
290
Ok ( MPlaceTy { mplace, layout } )
291
291
}
@@ -321,13 +321,13 @@ impl
321
321
let field_layout = base. layout . field ( self , usize:: try_from ( field) . unwrap_or ( 0 ) ) ?;
322
322
323
323
// Offset may need adjustment for unsized fields
324
- let ( extra , offset) = if field_layout. is_unsized ( ) {
324
+ let ( meta , offset) = if field_layout. is_unsized ( ) {
325
325
// re-use parent metadata to determine dynamic field layout
326
- let ( _, align) = self . size_and_align_of ( base. extra , field_layout) ?;
327
- ( base. extra , offset. abi_align ( align) )
326
+ let ( _, align) = self . size_and_align_of ( base. meta , field_layout) ?;
327
+ ( base. meta , offset. abi_align ( align) )
328
328
329
329
} else {
330
- // base.extra could be present; we might be accessing a sized field of an unsized
330
+ // base.meta could be present; we might be accessing a sized field of an unsized
331
331
// struct.
332
332
( None , offset)
333
333
} ;
338
338
// codegen -- mostly to see if we can get away with that
339
339
. restrict_for_offset ( offset) ; // must be last thing that happens
340
340
341
- Ok ( MPlaceTy { mplace : MemPlace { ptr, align, extra } , layout : field_layout } )
341
+ Ok ( MPlaceTy { mplace : MemPlace { ptr, align, meta } , layout : field_layout } )
342
342
}
343
343
344
344
// Iterates over all fields of an array. Much more efficient than doing the
359
359
Ok ( ( 0 ..len) . map ( move |i| {
360
360
let ptr = base. ptr . ptr_offset ( i * stride, dl) ?;
361
361
Ok ( MPlaceTy {
362
- mplace : MemPlace { ptr, align : base. align , extra : None } ,
362
+ mplace : MemPlace { ptr, align : base. align , meta : None } ,
363
363
layout
364
364
} )
365
365
} ) )
383
383
} ;
384
384
let ptr = base. ptr . ptr_offset ( from_offset, self ) ?;
385
385
386
- // Compute extra and new layout
386
+ // Compute meta and new layout
387
387
let inner_len = len - to - from;
388
- let ( extra , ty) = match base. layout . ty . sty {
388
+ let ( meta , ty) = match base. layout . ty . sty {
389
389
// It is not nice to match on the type, but that seems to be the only way to
390
390
// implement this.
391
391
ty:: Array ( inner, _) =>
400
400
let layout = self . layout_of ( ty) ?;
401
401
402
402
Ok ( MPlaceTy {
403
- mplace : MemPlace { ptr, align : base. align , extra } ,
403
+ mplace : MemPlace { ptr, align : base. align , meta } ,
404
404
layout
405
405
} )
406
406
}
411
411
variant : usize ,
412
412
) -> EvalResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
413
413
// Downcasts only change the layout
414
- assert ! ( base. extra . is_none( ) ) ;
414
+ assert ! ( base. meta . is_none( ) ) ;
415
415
Ok ( MPlaceTy { layout : base. layout . for_variant ( self , variant) , ..base } )
416
416
}
417
417
838
838
}
839
839
840
840
let mplace = MPlaceTy {
841
- mplace : MemPlace { extra : None , ..* mplace } ,
841
+ mplace : MemPlace { meta : None , ..* mplace } ,
842
842
layout
843
843
} ;
844
844
Ok ( ( instance, mplace) )
0 commit comments