@@ -18,16 +18,16 @@ pub type PtrId = NonZeroU64;
1818pub type CallId = NonZeroU64 ;
1919
2020/// Tracking pointer provenance
21- #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq ) ]
21+ #[ derive( Copy , Clone , Hash , PartialEq , Eq ) ]
2222pub enum Tag {
2323 Tagged ( PtrId ) ,
2424 Untagged ,
2525}
2626
27- impl fmt:: Display for Tag {
27+ impl fmt:: Debug for Tag {
2828 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2929 match self {
30- Tag :: Tagged ( id) => write ! ( f, "{} " , id) ,
30+ Tag :: Tagged ( id) => write ! ( f, "<{}> " , id) ,
3131 Tag :: Untagged => write ! ( f, "<untagged>" ) ,
3232 }
3333 }
@@ -48,7 +48,7 @@ pub enum Permission {
4848}
4949
5050/// An item in the per-location borrow stack.
51- #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq ) ]
51+ #[ derive( Copy , Clone , Hash , PartialEq , Eq ) ]
5252pub struct Item {
5353 /// The permission this item grants.
5454 perm : Permission ,
@@ -58,9 +58,9 @@ pub struct Item {
5858 protector : Option < CallId > ,
5959}
6060
61- impl fmt:: Display for Item {
61+ impl fmt:: Debug for Item {
6262 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
63- write ! ( f, "[{:?} for {}" , self . perm, self . tag) ?;
63+ write ! ( f, "[{:?} for {:? }" , self . perm, self . tag) ?;
6464 if let Some ( call) = self . protector {
6565 write ! ( f, " (call {})" , call) ?;
6666 }
@@ -99,7 +99,7 @@ pub struct GlobalState {
9999pub type MemoryState = Rc < RefCell < GlobalState > > ;
100100
101101/// Indicates which kind of access is being performed.
102- #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq ) ]
102+ #[ derive( Copy , Clone , Hash , PartialEq , Eq ) ]
103103pub enum AccessKind {
104104 Read ,
105105 Write ,
@@ -108,16 +108,16 @@ pub enum AccessKind {
108108impl fmt:: Display for AccessKind {
109109 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
110110 match self {
111- AccessKind :: Read => write ! ( f, "read" ) ,
112- AccessKind :: Write => write ! ( f, "write" ) ,
111+ AccessKind :: Read => write ! ( f, "read access " ) ,
112+ AccessKind :: Write => write ! ( f, "write access " ) ,
113113 }
114114 }
115115}
116116
117117/// Indicates which kind of reference is being created.
118118/// Used by high-level `reborrow` to compute which permissions to grant to the
119119/// new pointer.
120- #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq ) ]
120+ #[ derive( Copy , Clone , Hash , PartialEq , Eq ) ]
121121pub enum RefKind {
122122 /// `&mut` and `Box`.
123123 Unique { two_phase : bool } ,
@@ -261,12 +261,12 @@ impl<'tcx> Stack {
261261 if global. is_active ( call) {
262262 if let Some ( tag) = tag {
263263 return err ! ( MachineError ( format!(
264- "not granting access to tag {} because incompatible item is protected: {}" ,
264+ "not granting access to tag {:? } because incompatible item is protected: {:? }" ,
265265 tag, item
266266 ) ) ) ;
267267 } else {
268268 return err ! ( MachineError ( format!(
269- "deallocating while item is protected: {}" , item
269+ "deallocating while item is protected: {:? }" , item
270270 ) ) ) ;
271271 }
272272 }
@@ -287,7 +287,7 @@ impl<'tcx> Stack {
287287 // Step 1: Find granting item.
288288 let granting_idx = self . find_granting ( access, tag)
289289 . ok_or_else ( || InterpError :: MachineError ( format ! (
290- "no item granting {} access to tag {} found in borrow stack" ,
290+ "no item granting {} to tag {:? } found in borrow stack" ,
291291 access, tag,
292292 ) ) ) ?;
293293
@@ -298,7 +298,7 @@ impl<'tcx> Stack {
298298 // pointers become invalid on write accesses (ensures F2a, and ensures U2 for write accesses).
299299 let first_incompatible_idx = self . find_first_write_incompaible ( granting_idx) ;
300300 for item in self . borrows . drain ( first_incompatible_idx..) . rev ( ) {
301- trace ! ( "access: popping item {}" , item) ;
301+ trace ! ( "access: popping item {:? }" , item) ;
302302 Stack :: check_protector ( & item, Some ( tag) , global) ?;
303303 }
304304 } else {
@@ -313,7 +313,7 @@ impl<'tcx> Stack {
313313 for idx in ( granting_idx+1 .. self . borrows . len ( ) ) . rev ( ) {
314314 let item = & mut self . borrows [ idx] ;
315315 if item. perm == Permission :: Unique {
316- trace ! ( "access: disabling item {}" , item) ;
316+ trace ! ( "access: disabling item {:? }" , item) ;
317317 Stack :: check_protector ( item, Some ( tag) , global) ?;
318318 item. perm = Permission :: Disabled ;
319319 }
@@ -334,7 +334,7 @@ impl<'tcx> Stack {
334334 // Step 1: Find granting item.
335335 self . find_granting ( AccessKind :: Write , tag)
336336 . ok_or_else ( || InterpError :: MachineError ( format ! (
337- "no item granting write access for deallocation to tag {} found in borrow stack" ,
337+ "no item granting write access for deallocation to tag {:? } found in borrow stack" ,
338338 tag,
339339 ) ) ) ?;
340340
@@ -383,7 +383,7 @@ impl<'tcx> Stack {
383383 // We use that to determine where to put the new item.
384384 let granting_idx = self . find_granting ( access, derived_from)
385385 . ok_or_else ( || InterpError :: MachineError ( format ! (
386- "trying to reborrow for {:?}, but parent tag {} does not have an appropriate item in the borrow stack" , new. perm, derived_from,
386+ "trying to reborrow for {:?}, but parent tag {:? } does not have an appropriate item in the borrow stack" , new. perm, derived_from,
387387 ) ) ) ?;
388388
389389 // Compute where to put the new item.
@@ -412,9 +412,9 @@ impl<'tcx> Stack {
412412 // Put the new item there. As an optimization, deduplicate if it is equal to one of its new neighbors.
413413 if self . borrows [ new_idx-1 ] == new || self . borrows . get ( new_idx) == Some ( & new) {
414414 // Optimization applies, done.
415- trace ! ( "reborrow: avoiding adding redundant item {}" , new) ;
415+ trace ! ( "reborrow: avoiding adding redundant item {:? }" , new) ;
416416 } else {
417- trace ! ( "reborrow: adding item {}" , new) ;
417+ trace ! ( "reborrow: adding item {:? }" , new) ;
418418 self . borrows . insert ( new_idx, new) ;
419419 }
420420
@@ -497,7 +497,7 @@ impl AllocationExtra<Tag> for Stacks {
497497 ptr : Pointer < Tag > ,
498498 size : Size ,
499499 ) -> EvalResult < ' tcx > {
500- trace ! ( "read access with tag {}: {:?}, size {}" , ptr. tag, ptr, size. bytes( ) ) ;
500+ trace ! ( "read access with tag {:? }: {:?}, size {}" , ptr. tag, ptr, size. bytes( ) ) ;
501501 alloc. extra . for_each ( ptr, size, |stack, global| {
502502 stack. access ( AccessKind :: Read , ptr. tag , global) ?;
503503 Ok ( ( ) )
@@ -510,7 +510,7 @@ impl AllocationExtra<Tag> for Stacks {
510510 ptr : Pointer < Tag > ,
511511 size : Size ,
512512 ) -> EvalResult < ' tcx > {
513- trace ! ( "write access with tag {}: {:?}, size {}" , ptr. tag, ptr, size. bytes( ) ) ;
513+ trace ! ( "write access with tag {:? }: {:?}, size {}" , ptr. tag, ptr, size. bytes( ) ) ;
514514 alloc. extra . for_each ( ptr, size, |stack, global| {
515515 stack. access ( AccessKind :: Write , ptr. tag , global) ?;
516516 Ok ( ( ) )
@@ -523,7 +523,7 @@ impl AllocationExtra<Tag> for Stacks {
523523 ptr : Pointer < Tag > ,
524524 size : Size ,
525525 ) -> EvalResult < ' tcx > {
526- trace ! ( "deallocation with tag {}: {:?}, size {}" , ptr. tag, ptr, size. bytes( ) ) ;
526+ trace ! ( "deallocation with tag {:? }: {:?}, size {}" , ptr. tag, ptr, size. bytes( ) ) ;
527527 alloc. extra . for_each ( ptr, size, |stack, global| {
528528 stack. dealloc ( ptr. tag , global)
529529 } )
@@ -545,7 +545,7 @@ trait EvalContextPrivExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
545545 let this = self . eval_context_mut ( ) ;
546546 let protector = if protect { Some ( this. frame ( ) . extra ) } else { None } ;
547547 let ptr = place. ptr . to_ptr ( ) ?;
548- trace ! ( "reborrow: {} reference {} derived from {} (pointee {}): {:?}, size {}" ,
548+ trace ! ( "reborrow: {} reference {:? } derived from {:? } (pointee {}): {:?}, size {}" ,
549549 kind, new_tag, ptr. tag, place. layout. ty, ptr, size. bytes( ) ) ;
550550
551551 // Get the allocation. It might not be mutable, so we cannot use `get_mut`.
0 commit comments