Skip to content

Commit bb5cea0

Browse files
authored
Merge pull request #516 from RalfJung/rc
Rc should be fixed
2 parents 61debe8 + e7aa5c6 commit bb5cea0

File tree

4 files changed

+12
-30
lines changed

4 files changed

+12
-30
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2018-11-08
1+
nightly-2018-11-12

src/lib.rs

-18
Original file line numberDiff line numberDiff line change
@@ -446,24 +446,6 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
446446
Cow::Owned(alloc)
447447
}
448448

449-
#[inline(always)]
450-
fn memory_read(
451-
alloc: &Allocation<Borrow, Self::AllocExtra>,
452-
ptr: Pointer<Borrow>,
453-
size: Size,
454-
) -> EvalResult<'tcx> {
455-
alloc.extra.memory_read(ptr, size)
456-
}
457-
458-
#[inline(always)]
459-
fn memory_written(
460-
alloc: &mut Allocation<Borrow, Self::AllocExtra>,
461-
ptr: Pointer<Borrow>,
462-
size: Size,
463-
) -> EvalResult<'tcx> {
464-
alloc.extra.memory_written(ptr, size)
465-
}
466-
467449
#[inline(always)]
468450
fn memory_deallocated(
469451
alloc: &mut Allocation<Borrow, Self::AllocExtra>,

src/stacked_borrows.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::hir;
55

66
use crate::{
77
EvalResult, MiriEvalContext, HelpersEvalContextExt,
8-
MemoryKind, MiriMemoryKind, RangeMap, AllocId,
8+
MemoryKind, MiriMemoryKind, RangeMap, AllocId, Allocation, AllocationExtra,
99
Pointer, PlaceTy, MPlaceTy,
1010
};
1111

@@ -343,27 +343,30 @@ impl<'tcx> Stacks {
343343
}
344344

345345
/// Hooks and glue
346-
impl<'tcx> Stacks {
346+
impl AllocationExtra<Borrow> for Stacks {
347347
#[inline(always)]
348-
pub fn memory_read(
349-
&self,
348+
fn memory_read<'tcx>(
349+
alloc: &Allocation<Borrow, Stacks>,
350350
ptr: Pointer<Borrow>,
351351
size: Size,
352352
) -> EvalResult<'tcx> {
353353
// Reads behave exactly like the first half of a reborrow-to-shr
354-
self.use_and_maybe_re_borrow(ptr, size, UsageKind::Read, None)
354+
alloc.extra.use_and_maybe_re_borrow(ptr, size, UsageKind::Read, None)
355355
}
356356

357357
#[inline(always)]
358-
pub fn memory_written(
359-
&mut self,
358+
fn memory_written<'tcx>(
359+
alloc: &mut Allocation<Borrow, Stacks>,
360360
ptr: Pointer<Borrow>,
361361
size: Size,
362362
) -> EvalResult<'tcx> {
363363
// Writes behave exactly like the first half of a reborrow-to-mut
364-
self.use_and_maybe_re_borrow(ptr, size, UsageKind::Write, None)
364+
alloc.extra.use_and_maybe_re_borrow(ptr, size, UsageKind::Write, None)
365365
}
366+
}
366367

368+
impl<'tcx> Stacks {
369+
#[inline(always)]
367370
pub fn memory_deallocated(
368371
&mut self,
369372
ptr: Pointer<Borrow>,

tests/run-pass/rc.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// FIXME: Disabled due to https://github.com/rust-lang/rust/issues/55747
2-
// ignore-test
3-
41
use std::cell::RefCell;
52
use std::rc::Rc;
63

0 commit comments

Comments
 (0)