@@ -276,7 +276,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
276
276
kind : MemoryKind < M :: MemoryKind > ,
277
277
) -> InterpResult < ' tcx > {
278
278
let ( alloc_id, offset, tag) = self . ptr_get_alloc_id ( ptr) ?;
279
- trace ! ( "deallocating: {}" , alloc_id ) ;
279
+ trace ! ( "deallocating: {alloc_id:?}" ) ;
280
280
281
281
if offset. bytes ( ) != 0 {
282
282
throw_ub_format ! (
@@ -289,10 +289,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
289
289
// Deallocating global memory -- always an error
290
290
return Err ( match self . tcx . get_global_alloc ( alloc_id) {
291
291
Some ( GlobalAlloc :: Function ( ..) ) => {
292
- err_ub_format ! ( "deallocating {}, which is a function" , alloc_id )
292
+ err_ub_format ! ( "deallocating {alloc_id:? }, which is a function" )
293
293
}
294
294
Some ( GlobalAlloc :: Static ( ..) | GlobalAlloc :: Memory ( ..) ) => {
295
- err_ub_format ! ( "deallocating {}, which is static memory" , alloc_id )
295
+ err_ub_format ! ( "deallocating {alloc_id:? }, which is static memory" )
296
296
}
297
297
None => err_ub ! ( PointerUseAfterFree ( alloc_id) ) ,
298
298
}
@@ -302,21 +302,19 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
302
302
debug ! ( ?alloc) ;
303
303
304
304
if alloc. mutability == Mutability :: Not {
305
- throw_ub_format ! ( "deallocating immutable allocation {}" , alloc_id ) ;
305
+ throw_ub_format ! ( "deallocating immutable allocation {alloc_id:?}" ) ;
306
306
}
307
307
if alloc_kind != kind {
308
308
throw_ub_format ! (
309
- "deallocating {}, which is {} memory, using {} deallocation operation" ,
310
- alloc_id,
309
+ "deallocating {alloc_id:?}, which is {} memory, using {} deallocation operation" ,
311
310
alloc_kind,
312
311
kind
313
312
) ;
314
313
}
315
314
if let Some ( ( size, align) ) = old_size_and_align {
316
315
if size != alloc. size ( ) || align != alloc. align {
317
316
throw_ub_format ! (
318
- "incorrect layout on deallocation: {} has size {} and alignment {}, but gave size {} and alignment {}" ,
319
- alloc_id,
317
+ "incorrect layout on deallocation: {alloc_id:?} has size {} and alignment {}, but gave size {} and alignment {}" ,
320
318
alloc. size( ) . bytes( ) ,
321
319
alloc. align. bytes( ) ,
322
320
size. bytes( ) ,
@@ -815,7 +813,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> std::fmt::Debug for DumpAllocs<'a,
815
813
continue ;
816
814
}
817
815
818
- write ! ( fmt, "{}" , id ) ?;
816
+ write ! ( fmt, "{id:?}" ) ?;
819
817
match self . ecx . memory . alloc_map . get ( id) {
820
818
Some ( & ( kind, ref alloc) ) => {
821
819
// normal alloc
@@ -865,13 +863,7 @@ impl<'tcx, 'a, Tag: Provenance, Extra> AllocRefMut<'a, 'tcx, Tag, Extra> {
865
863
val : ScalarMaybeUninit < Tag > ,
866
864
) -> InterpResult < ' tcx > {
867
865
let range = self . range . subrange ( range) ;
868
- debug ! (
869
- "write_scalar in {} at {:#x}, size {}: {:?}" ,
870
- self . alloc_id,
871
- range. start. bytes( ) ,
872
- range. size. bytes( ) ,
873
- val
874
- ) ;
866
+ debug ! ( "write_scalar at {:?}{range:?}: {val:?}" , self . alloc_id) ;
875
867
Ok ( self
876
868
. alloc
877
869
. write_scalar ( & self . tcx , range, val)
@@ -906,13 +898,7 @@ impl<'tcx, 'a, Tag: Provenance, Extra> AllocRef<'a, 'tcx, Tag, Extra> {
906
898
. alloc
907
899
. read_scalar ( & self . tcx , range, read_provenance)
908
900
. map_err ( |e| e. to_interp_error ( self . alloc_id ) ) ?;
909
- debug ! (
910
- "read_scalar in {} at {:#x}, size {}: {:?}" ,
911
- self . alloc_id,
912
- range. start. bytes( ) ,
913
- range. size. bytes( ) ,
914
- res
915
- ) ;
901
+ debug ! ( "read_scalar at {:?}{range:?}: {res:?}" , self . alloc_id) ;
916
902
Ok ( res)
917
903
}
918
904
0 commit comments