@@ -57,10 +57,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
57
57
58
58
Pointer ( PointerCast :: ReifyFnPointer ) => {
59
59
// The src operand does not matter, just its type
60
- match * src. layout . ty . kind ( ) {
60
+ match * src. layout ( ) . ty . kind ( ) {
61
61
ty:: FnDef ( def_id, substs) => {
62
62
// All reifications must be monomorphic, bail out otherwise.
63
- ensure_monomorphic_enough ( * self . tcx , src. layout . ty ) ?;
63
+ ensure_monomorphic_enough ( * self . tcx , src. layout ( ) . ty ) ?;
64
64
65
65
let instance = ty:: Instance :: resolve_for_fn_ptr (
66
66
* self . tcx ,
@@ -73,7 +73,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
73
73
let fn_ptr = self . create_fn_alloc_ptr ( FnVal :: Instance ( instance) ) ;
74
74
self . write_pointer ( fn_ptr, dest) ?;
75
75
}
76
- _ => span_bug ! ( self . cur_span( ) , "reify fn pointer on {:?}" , src. layout. ty) ,
76
+ _ => span_bug ! ( self . cur_span( ) , "reify fn pointer on {:?}" , src. layout( ) . ty) ,
77
77
}
78
78
}
79
79
@@ -90,10 +90,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
90
90
91
91
Pointer ( PointerCast :: ClosureFnPointer ( _) ) => {
92
92
// The src operand does not matter, just its type
93
- match * src. layout . ty . kind ( ) {
93
+ match * src. layout ( ) . ty . kind ( ) {
94
94
ty:: Closure ( def_id, substs) => {
95
95
// All reifications must be monomorphic, bail out otherwise.
96
- ensure_monomorphic_enough ( * self . tcx , src. layout . ty ) ?;
96
+ ensure_monomorphic_enough ( * self . tcx , src. layout ( ) . ty ) ?;
97
97
98
98
let instance = ty:: Instance :: resolve_closure (
99
99
* self . tcx ,
@@ -105,7 +105,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
105
105
let fn_ptr = self . create_fn_alloc_ptr ( FnVal :: Instance ( instance) ) ;
106
106
self . write_pointer ( fn_ptr, dest) ?;
107
107
}
108
- _ => span_bug ! ( self . cur_span( ) , "closure fn pointer on {:?}" , src. layout. ty) ,
108
+ _ => span_bug ! ( self . cur_span( ) , "closure fn pointer on {:?}" , src. layout( ) . ty) ,
109
109
}
110
110
}
111
111
}
@@ -328,7 +328,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
328
328
}
329
329
330
330
_ => {
331
- span_bug ! ( self . cur_span( ) , "invalid unsizing {:?} -> {:?}" , src. layout. ty, cast_ty)
331
+ span_bug ! (
332
+ self . cur_span( ) ,
333
+ "invalid unsizing {:?} -> {:?}" ,
334
+ src. layout( ) . ty,
335
+ cast_ty
336
+ )
332
337
}
333
338
}
334
339
}
@@ -339,8 +344,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
339
344
cast_ty : TyAndLayout < ' tcx > ,
340
345
dest : & PlaceTy < ' tcx , M :: PointerTag > ,
341
346
) -> InterpResult < ' tcx > {
342
- trace ! ( "Unsizing {:?} of type {} into {:?}" , * src, src. layout. ty, cast_ty. ty) ;
343
- match ( & src. layout . ty . kind ( ) , & cast_ty. ty . kind ( ) ) {
347
+ trace ! ( "Unsizing {:?} of type {} into {:?}" , * src, src. layout( ) . ty, cast_ty. ty) ;
348
+ match ( & src. layout ( ) . ty . kind ( ) , & cast_ty. ty . kind ( ) ) {
344
349
( & ty:: Ref ( _, s, _) , & ty:: Ref ( _, c, _) | & ty:: RawPtr ( TypeAndMut { ty : c, .. } ) )
345
350
| ( & ty:: RawPtr ( TypeAndMut { ty : s, .. } ) , & ty:: RawPtr ( TypeAndMut { ty : c, .. } ) ) => {
346
351
self . unsize_into_ptr ( src, dest, * s, * c)
@@ -351,14 +356,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
351
356
// unsizing of generic struct with pointer fields
352
357
// Example: `Arc<T>` -> `Arc<Trait>`
353
358
// here we need to increase the size of every &T thin ptr field to a fat ptr
354
- for i in 0 ..src. layout . fields . count ( ) {
359
+ for i in 0 ..src. layout ( ) . fields . count ( ) {
355
360
let cast_ty_field = cast_ty. field ( self , i) ;
356
361
if cast_ty_field. is_zst ( ) {
357
362
continue ;
358
363
}
359
364
let src_field = self . operand_field ( src, i) ?;
360
365
let dst_field = self . place_field ( dest, i) ?;
361
- if src_field. layout . ty == cast_ty_field. ty {
366
+ if src_field. layout ( ) . ty == cast_ty_field. ty {
362
367
self . copy_op ( & src_field, & dst_field, /*allow_transmute*/ false ) ?;
363
368
} else {
364
369
self . unsize_into ( & src_field, cast_ty_field, & dst_field) ?;
@@ -369,7 +374,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
369
374
_ => span_bug ! (
370
375
self . cur_span( ) ,
371
376
"unsize_into: invalid conversion: {:?} -> {:?}" ,
372
- src. layout,
377
+ src. layout( ) ,
373
378
dest. layout
374
379
) ,
375
380
}
0 commit comments