Skip to content

Commit 324b928

Browse files
committed
remove retag_box_to_raw, it is no longer needed
1 parent f361080 commit 324b928

File tree

4 files changed

+1
-53
lines changed

4 files changed

+1
-53
lines changed

src/borrow_tracker/mod.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::num::NonZero;
55
use smallvec::SmallVec;
66

77
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
8-
use rustc_middle::{mir::RetagKind, ty::Ty};
8+
use rustc_middle::mir::RetagKind;
99
use rustc_target::abi::Size;
1010

1111
use crate::*;
@@ -291,19 +291,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
291291
}
292292
}
293293

294-
fn retag_box_to_raw(
295-
&mut self,
296-
val: &ImmTy<'tcx, Provenance>,
297-
alloc_ty: Ty<'tcx>,
298-
) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> {
299-
let this = self.eval_context_mut();
300-
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
301-
match method {
302-
BorrowTrackerMethod::StackedBorrows => this.sb_retag_box_to_raw(val, alloc_ty),
303-
BorrowTrackerMethod::TreeBorrows => this.tb_retag_box_to_raw(val, alloc_ty),
304-
}
305-
}
306-
307294
fn retag_place_contents(
308295
&mut self,
309296
kind: RetagKind,

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -865,24 +865,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
865865
this.sb_retag_reference(val, new_perm, RetagInfo { cause, in_field: false })
866866
}
867867

868-
fn sb_retag_box_to_raw(
869-
&mut self,
870-
val: &ImmTy<'tcx, Provenance>,
871-
alloc_ty: Ty<'tcx>,
872-
) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> {
873-
let this = self.eval_context_mut();
874-
let is_global_alloc = alloc_ty.ty_adt_def().is_some_and(|adt| {
875-
let global_alloc = this.tcx.require_lang_item(rustc_hir::LangItem::GlobalAlloc, None);
876-
adt.did() == global_alloc
877-
});
878-
if is_global_alloc {
879-
// Retag this as-if it was a mutable reference.
880-
this.sb_retag_ptr_value(RetagKind::Raw, val)
881-
} else {
882-
Ok(val.clone())
883-
}
884-
}
885-
886868
fn sb_retag_place_contents(
887869
&mut self,
888870
kind: RetagKind,

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
392392
}
393393
}
394394

395-
fn tb_retag_box_to_raw(
396-
&mut self,
397-
val: &ImmTy<'tcx, Provenance>,
398-
_alloc_ty: Ty<'tcx>,
399-
) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> {
400-
// Casts to raw pointers are NOPs in Tree Borrows.
401-
Ok(val.clone())
402-
}
403-
404395
/// Retag all pointers that are stored in this place.
405396
fn tb_retag_place_contents(
406397
&mut self,

src/shims/intrinsics/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
140140

141141
this.write_pointer(Pointer::new(ptr.provenance, masked_addr), dest)?;
142142
}
143-
"retag_box_to_raw" => {
144-
let [ptr] = check_arg_count(args)?;
145-
let alloc_ty = generic_args[1].expect_ty();
146-
147-
let val = this.read_immediate(ptr)?;
148-
let new_val = if this.machine.borrow_tracker.is_some() {
149-
this.retag_box_to_raw(&val, alloc_ty)?
150-
} else {
151-
val
152-
};
153-
this.write_immediate(*new_val, dest)?;
154-
}
155143

156144
// We want to return either `true` or `false` at random, or else something like
157145
// ```

0 commit comments

Comments
 (0)