Skip to content

Commit 68ab457

Browse files
committed
Pass AccessKind to check_protector
1 parent cddd85e commit 68ab457

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/stacked_borrows.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,21 @@ impl<'tcx> Stack {
327327
/// `None` during a deallocation.
328328
fn check_protector(
329329
item: &Item,
330-
provoking_access: Option<(SbTag, AllocId, AllocRange, Size)>, // just for debug printing and error messages
330+
provoking_access: Option<(SbTag, AllocId, AllocRange, Size, AccessKind)>, // just for debug printing and error messages
331331
global: &GlobalStateInner,
332332
) -> InterpResult<'tcx> {
333333
if let SbTag::Tagged(id) = item.tag {
334334
if global.tracked_pointer_tags.contains(&id) {
335335
register_diagnostic(NonHaltingDiagnostic::PoppedPointerTag(
336336
*item,
337-
None,
337+
provoking_access
338+
.map(|(tag, _alloc_id, _alloc_range, _size, access)| (tag, access)),
338339
));
339340
}
340341
}
341342
if let Some(call) = item.protector {
342343
if global.is_active(call) {
343-
if let Some((tag, alloc_id, alloc_range, offset)) = provoking_access {
344+
if let Some((tag, alloc_id, alloc_range, offset, _access)) = provoking_access {
344345
Err(err_sb_ub(
345346
format!(
346347
"not granting access to tag {:?} because incompatible item is protected: {:?}",
@@ -393,7 +394,11 @@ impl<'tcx> Stack {
393394
let first_incompatible_idx = self.find_first_write_incompatible(granting_idx);
394395
for item in self.borrows.drain(first_incompatible_idx..).rev() {
395396
trace!("access: popping item {:?}", item);
396-
Stack::check_protector(&item, Some((tag, alloc_id, alloc_range, offset)), global)?;
397+
Stack::check_protector(
398+
&item,
399+
Some((tag, alloc_id, alloc_range, offset, access)),
400+
global,
401+
)?;
397402
global.add_invalidation(item.tag, alloc_id, alloc_range);
398403
}
399404
} else {
@@ -411,7 +416,7 @@ impl<'tcx> Stack {
411416
trace!("access: disabling item {:?}", item);
412417
Stack::check_protector(
413418
item,
414-
Some((tag, alloc_id, alloc_range, offset)),
419+
Some((tag, alloc_id, alloc_range, offset, access)),
415420
global,
416421
)?;
417422
item.perm = Permission::Disabled;

0 commit comments

Comments
 (0)