@@ -111,7 +111,7 @@ pub struct GlobalState {
111
111
pub type MemoryExtra = RefCell < GlobalState > ;
112
112
113
113
/// Indicates which kind of access is being performed.
114
- #[ derive( Copy , Clone , Hash , PartialEq , Eq ) ]
114
+ #[ derive( Copy , Clone , Hash , PartialEq , Eq , Debug ) ]
115
115
pub enum AccessKind {
116
116
Read ,
117
117
Write ,
@@ -300,10 +300,15 @@ impl<'tcx> Stack {
300
300
item : & Item ,
301
301
tag : Option < SbTag > ,
302
302
global : & GlobalState ,
303
+ cause : AccessKind ,
303
304
) -> InterpResult < ' tcx > {
304
305
if let SbTag :: Tagged ( id) = item. tag {
305
306
if Some ( id) == global. tracked_pointer_tag {
306
- register_diagnostic ( NonHaltingDiagnostic :: PoppedPointerTag ( item. clone ( ) ) ) ;
307
+ register_diagnostic ( NonHaltingDiagnostic :: PoppedPointerTag (
308
+ item. clone ( ) ,
309
+ cause,
310
+ tag,
311
+ ) ) ;
307
312
}
308
313
}
309
314
if let Some ( call) = item. protector {
@@ -348,7 +353,7 @@ impl<'tcx> Stack {
348
353
let first_incompatible_idx = self . find_first_write_incompatible ( granting_idx) ;
349
354
for item in self . borrows . drain ( first_incompatible_idx..) . rev ( ) {
350
355
trace ! ( "access: popping item {:?}" , item) ;
351
- Stack :: check_protector ( & item, Some ( tag) , global) ?;
356
+ Stack :: check_protector ( & item, Some ( tag) , global, access ) ?;
352
357
}
353
358
} else {
354
359
// On a read, *disable* all `Unique` above the granting item. This ensures U2 for read accesses.
@@ -363,7 +368,7 @@ impl<'tcx> Stack {
363
368
let item = & mut self . borrows [ idx] ;
364
369
if item. perm == Permission :: Unique {
365
370
trace ! ( "access: disabling item {:?}" , item) ;
366
- Stack :: check_protector ( item, Some ( tag) , global) ?;
371
+ Stack :: check_protector ( item, Some ( tag) , global, access ) ?;
367
372
item. perm = Permission :: Disabled ;
368
373
}
369
374
}
@@ -391,7 +396,7 @@ impl<'tcx> Stack {
391
396
392
397
// Step 2: Remove all items. Also checks for protectors.
393
398
for item in self . borrows . drain ( ..) . rev ( ) {
394
- Stack :: check_protector ( & item, None , global) ?;
399
+ Stack :: check_protector ( & item, None , global, AccessKind :: Write ) ?;
395
400
}
396
401
397
402
Ok ( ( ) )
0 commit comments