Skip to content

Rc should be fixed #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2018-11-08
nightly-2018-11-12
18 changes: 0 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,24 +446,6 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
Cow::Owned(alloc)
}

#[inline(always)]
fn memory_read(
alloc: &Allocation<Borrow, Self::AllocExtra>,
ptr: Pointer<Borrow>,
size: Size,
) -> EvalResult<'tcx> {
alloc.extra.memory_read(ptr, size)
}

#[inline(always)]
fn memory_written(
alloc: &mut Allocation<Borrow, Self::AllocExtra>,
ptr: Pointer<Borrow>,
size: Size,
) -> EvalResult<'tcx> {
alloc.extra.memory_written(ptr, size)
}

#[inline(always)]
fn memory_deallocated(
alloc: &mut Allocation<Borrow, Self::AllocExtra>,
Expand Down
19 changes: 11 additions & 8 deletions src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc::hir;

use crate::{
EvalResult, MiriEvalContext, HelpersEvalContextExt,
MemoryKind, MiriMemoryKind, RangeMap, AllocId,
MemoryKind, MiriMemoryKind, RangeMap, AllocId, Allocation, AllocationExtra,
Pointer, PlaceTy, MPlaceTy,
};

Expand Down Expand Up @@ -343,27 +343,30 @@ impl<'tcx> Stacks {
}

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

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

impl<'tcx> Stacks {
#[inline(always)]
pub fn memory_deallocated(
&mut self,
ptr: Pointer<Borrow>,
Expand Down
3 changes: 0 additions & 3 deletions tests/run-pass/rc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// FIXME: Disabled due to https://github.com/rust-lang/rust/issues/55747
// ignore-test

use std::cell::RefCell;
use std::rc::Rc;

Expand Down