update for rust/47205

This commit is contained in:
David Renshaw 2018-01-14 22:31:59 -05:00
parent cabdc5597c
commit 33af3208fd
3 changed files with 9 additions and 9 deletions

View file

@ -386,7 +386,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator<'
};
// compute global if not cached
let val = match self.tcx.interpret_interner.borrow().get_cached(cid) {
Some(ptr) => ptr,
Some(ptr) => MemoryPointer::new(ptr, 0).into(),
None => eval_body(self.tcx, instance, ty::ParamEnv::empty(traits::Reveal::All))?.0,
};
let val = self.value_to_primval(ValTy { value: Value::ByRef(val, name_align),

View file

@ -203,7 +203,7 @@ pub struct MemoryData<'tcx> {
///
/// Only mutable (static mut, heap, stack) allocations have an entry in this map.
/// The entry is created when allocating the memory and deleted after deallocation.
locks: HashMap<u64, RangeMap<LockInfo<'tcx>>>,
locks: HashMap<AllocId, RangeMap<LockInfo<'tcx>>>,
}
impl<'tcx> Machine<'tcx> for Evaluator<'tcx> {
@ -324,7 +324,7 @@ impl<'tcx> Machine<'tcx> for Evaluator<'tcx> {
instance,
promoted: None,
},
ptr.into(),
ptr.alloc_id,
);
Ok(())
}
@ -340,14 +340,14 @@ impl<'tcx> Machine<'tcx> for Evaluator<'tcx> {
fn add_lock<'a>(
mem: &mut Memory<'a, 'tcx, Self>,
id: u64,
id: AllocId,
) {
mem.data.locks.insert(id, RangeMap::new());
}
fn free_lock<'a>(
mem: &mut Memory<'a, 'tcx, Self>,
id: u64,
id: AllocId,
len: u64,
) -> EvalResult<'tcx> {
mem.data.locks

View file

@ -109,7 +109,7 @@ impl<'a, 'tcx: 'a> MemoryExt<'tcx> for Memory<'a, 'tcx, Evaluator<'tcx>> {
if len == 0 {
return Ok(());
}
let locks = match self.data.locks.get(&ptr.alloc_id.0) {
let locks = match self.data.locks.get(&ptr.alloc_id) {
Some(locks) => locks,
// immutable static or other constant memory
None => return Ok(()),
@ -148,7 +148,7 @@ impl<'a, 'tcx: 'a> MemoryExt<'tcx> for Memory<'a, 'tcx, Evaluator<'tcx>> {
);
self.check_bounds(ptr.offset(len, &*self)?, true)?; // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow)
let locks = match self.data.locks.get_mut(&ptr.alloc_id.0) {
let locks = match self.data.locks.get_mut(&ptr.alloc_id) {
Some(locks) => locks,
// immutable static or other constant memory
None => return Ok(()),
@ -197,7 +197,7 @@ impl<'a, 'tcx: 'a> MemoryExt<'tcx> for Memory<'a, 'tcx, Evaluator<'tcx>> {
) -> EvalResult<'tcx> {
assert!(len > 0);
let cur_frame = self.cur_frame;
let locks = match self.data.locks.get_mut(&ptr.alloc_id.0) {
let locks = match self.data.locks.get_mut(&ptr.alloc_id) {
Some(locks) => locks,
// immutable static or other constant memory
None => return Ok(()),
@ -275,7 +275,7 @@ impl<'a, 'tcx: 'a> MemoryExt<'tcx> for Memory<'a, 'tcx, Evaluator<'tcx>> {
frame: cur_frame,
path: lock_path.clone(),
};
let locks = match self.data.locks.get_mut(&ptr.alloc_id.0) {
let locks = match self.data.locks.get_mut(&ptr.alloc_id) {
Some(locks) => locks,
// immutable static or other constant memory
None => return Ok(()),