Skip to content

Commit 2be695b

Browse files
committed
Merge from rustc
2 parents 4d69711 + 0208c4c commit 2be695b

File tree

5 files changed

+239
-179
lines changed

5 files changed

+239
-179
lines changed

src/borrow_tracker/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_target::abi::Size;
1111

1212
use crate::*;
1313
pub mod stacked_borrows;
14-
use stacked_borrows::diagnostics::RetagCause;
1514

1615
pub type CallId = NonZeroU64;
1716

@@ -265,11 +264,19 @@ impl GlobalStateInner {
265264

266265
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {}
267266
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
268-
fn retag(&mut self, kind: RetagKind, place: &PlaceTy<'tcx, Provenance>) -> InterpResult<'tcx> {
267+
fn retag_ptr_value(&mut self, kind: RetagKind, val: &ImmTy<'tcx, Provenance>) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> {
269268
let this = self.eval_context_mut();
270269
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
271270
match method {
272-
BorrowTrackerMethod::StackedBorrows => this.sb_retag(kind, place),
271+
BorrowTrackerMethod::StackedBorrows => this.sb_retag_ptr_value(kind, val),
272+
}
273+
}
274+
275+
fn retag_place_contents(&mut self, kind: RetagKind, place: &PlaceTy<'tcx, Provenance>) -> InterpResult<'tcx> {
276+
let this = self.eval_context_mut();
277+
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
278+
match method {
279+
BorrowTrackerMethod::StackedBorrows => this.sb_retag_place_contents(kind, place),
273280
}
274281
}
275282

src/borrow_tracker/stacked_borrows/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,10 @@ impl<'history, 'ecx, 'mir, 'tcx> DiagnosticCx<'history, 'ecx, 'mir, 'tcx> {
459459
Operation::Dealloc(_) => format!(" due to deallocation"),
460460
Operation::Access(AccessOp { kind, tag, .. }) =>
461461
format!(" due to {kind:?} access for {tag:?}"),
462-
Operation::Retag(RetagOp { orig_tag, permission, .. }) => {
462+
Operation::Retag(RetagOp { orig_tag, permission, new_tag, .. }) => {
463463
let permission = permission
464464
.expect("start_grant should set the current permission before popping a tag");
465-
format!(" due to {permission:?} retag from {orig_tag:?}")
465+
format!(" due to {permission:?} retag from {orig_tag:?} (that retag created {new_tag:?})")
466466
}
467467
};
468468

0 commit comments

Comments
 (0)