Skip to content

Commit 1b41b71

Browse files
committed
update for MUT_STATIC_KIND
1 parent 1ba6140 commit 1b41b71

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/lib.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@ impl<'tcx> Hash for MemoryData<'tcx> {
274274
}
275275
}
276276

277-
impl<'mir, 'tcx: 'mir> Machine<'mir, 'tcx> for Evaluator<'tcx> {
277+
impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
278278
type MemoryData = MemoryData<'tcx>;
279279
type MemoryKinds = memory::MemoryKind;
280280

281+
const MUT_STATIC_KIND: Option<memory::MemoryKind> = Some(memory::MemoryKind::MutStatic);
282+
281283
/// Returns Ok() when the function was handled, fail otherwise
282284
fn find_fn<'a>(
283285
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
@@ -309,15 +311,6 @@ impl<'mir, 'tcx: 'mir> Machine<'mir, 'tcx> for Evaluator<'tcx> {
309311
ecx.ptr_op(bin_op, left, left_layout, right, right_layout)
310312
}
311313

312-
fn access_static_mut<'a, 'm>(
313-
mem: &'m mut Memory<'a, 'mir, 'tcx, Self>,
314-
id: AllocId,
315-
) -> EvalResult<'tcx, &'m mut Allocation> {
316-
// Make a copy, use that.
317-
mem.deep_copy_static(id, MiriMemoryKind::MutStatic.into())?;
318-
mem.get_mut(id) // this is recursive, but now we know that `id` is in `alloc_map` now
319-
}
320-
321314
fn box_alloc<'a>(
322315
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
323316
dest: PlaceTy<'tcx>,

src/memory.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use rustc_mir::interpret::IsStatic;
2-
31
#[derive(Debug, PartialEq, Copy, Clone, Hash, Eq)]
42
pub enum MemoryKind {
53
/// `__rust_alloc` memory
@@ -12,15 +10,6 @@ pub enum MemoryKind {
1210
MutStatic,
1311
}
1412

15-
impl IsStatic for MemoryKind {
16-
fn is_static(self) -> bool {
17-
match self {
18-
MemoryKind::MutStatic => true,
19-
_ => false,
20-
}
21-
}
22-
}
23-
2413
impl Into<::rustc_mir::interpret::MemoryKind<MemoryKind>> for MemoryKind {
2514
fn into(self) -> ::rustc_mir::interpret::MemoryKind<MemoryKind> {
2615
::rustc_mir::interpret::MemoryKind::Machine(self)

0 commit comments

Comments
 (0)