@@ -244,7 +244,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
244
244
let new_ptr = self . allocate ( new_size, new_align, kind) ;
245
245
let old_size = match old_size_and_align {
246
246
Some ( ( size, _align) ) => size,
247
- None => self . get_raw ( ptr. alloc_id ) ?. size ,
247
+ None => self . get_raw ( ptr. alloc_id ) ?. size ( ) ,
248
248
} ;
249
249
self . copy ( ptr, new_ptr, old_size. min ( new_size) , /*nonoverlapping*/ true ) ?;
250
250
self . deallocate ( ptr, old_size_and_align, kind) ?;
@@ -306,11 +306,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
306
306
) ;
307
307
}
308
308
if let Some ( ( size, align) ) = old_size_and_align {
309
- if size != alloc. size || align != alloc. align {
309
+ if size != alloc. size ( ) || align != alloc. align {
310
310
throw_ub_format ! (
311
311
"incorrect layout on deallocation: {} has size {} and alignment {}, but gave size {} and alignment {}" ,
312
312
ptr. alloc_id,
313
- alloc. size. bytes( ) ,
313
+ alloc. size( ) . bytes( ) ,
314
314
alloc. align. bytes( ) ,
315
315
size. bytes( ) ,
316
316
align. bytes( ) ,
@@ -319,11 +319,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
319
319
}
320
320
321
321
// Let the machine take some extra action
322
- let size = alloc. size ;
322
+ let size = alloc. size ( ) ;
323
323
AllocationExtra :: memory_deallocated ( & mut alloc, ptr, size) ?;
324
324
325
325
// Don't forget to remember size and align of this now-dead allocation
326
- let old = self . dead_alloc_map . insert ( ptr. alloc_id , ( alloc. size , alloc. align ) ) ;
326
+ let old = self . dead_alloc_map . insert ( ptr. alloc_id , ( alloc. size ( ) , alloc. align ) ) ;
327
327
if old. is_some ( ) {
328
328
bug ! ( "Nothing can be deallocated twice" ) ;
329
329
}
@@ -586,7 +586,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
586
586
// a) cause cycles in case `id` refers to a static
587
587
// b) duplicate a global's allocation in miri
588
588
if let Some ( ( _, alloc) ) = self . alloc_map . get ( id) {
589
- return Ok ( ( alloc. size , alloc. align ) ) ;
589
+ return Ok ( ( alloc. size ( ) , alloc. align ) ) ;
590
590
}
591
591
592
592
// # Function pointers
@@ -614,7 +614,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
614
614
Some ( GlobalAlloc :: Memory ( alloc) ) => {
615
615
// Need to duplicate the logic here, because the global allocations have
616
616
// different associated types than the interpreter-local ones.
617
- Ok ( ( alloc. size , alloc. align ) )
617
+ Ok ( ( alloc. size ( ) , alloc. align ) )
618
618
}
619
619
Some ( GlobalAlloc :: Function ( _) ) => bug ! ( "We already checked function pointers above" ) ,
620
620
// The rest must be dead.
0 commit comments