diff options
Diffstat (limited to 'src/librustc_mir')
-rw-r--r-- | src/librustc_mir/interpret/machine.rs | 4 | ||||
-rw-r--r-- | src/librustc_mir/interpret/memory.rs | 6 | ||||
-rw-r--r-- | src/librustc_mir/interpret/place.rs | 3 | ||||
-rw-r--r-- | src/librustc_mir/interpret/validity.rs | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 7e42fd97c56..047996777ea 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -20,7 +20,7 @@ use rustc::mir; use rustc::ty::{self, layout::{Size, TyLayout}, query::TyCtxtAt}; use super::{ - Allocation, AllocId, EvalResult, Scalar, + Allocation, AllocId, EvalResult, Scalar, AllocationExtra, EvalContext, PlaceTy, MPlaceTy, OpTy, Pointer, MemoryKind, }; @@ -78,7 +78,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { type PointerTag: ::std::fmt::Debug + Default + Copy + Eq + Hash + 'static; /// Extra data stored in every allocation. - type AllocExtra: ::std::fmt::Debug + Default + Clone; + type AllocExtra: AllocationExtra<Self::PointerTag>; /// Memory's allocation map type MemoryMap: diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 6a109efe3c4..ef2510dec35 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -28,7 +28,7 @@ use rustc_data_structures::fx::{FxHashSet, FxHashMap}; use syntax::ast::Mutability; use super::{ - Pointer, AllocId, Allocation, ConstValue, GlobalId, + Pointer, AllocId, Allocation, ConstValue, GlobalId, AllocationExtra, EvalResult, Scalar, EvalErrorKind, AllocType, PointerArithmetic, Machine, AllocMap, MayLeak, ScalarMaybeUndef, ErrorHandled, }; @@ -637,7 +637,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } let alloc = self.get(ptr.alloc_id)?; - M::memory_read(alloc, ptr, size)?; + AllocationExtra::memory_read(&alloc.extra, ptr, size)?; assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); assert_eq!(size.bytes() as usize as u64, size.bytes()); @@ -683,7 +683,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { self.clear_relocations(ptr, size)?; let alloc = self.get_mut(ptr.alloc_id)?; - M::memory_written(alloc, ptr, size)?; + AllocationExtra::memory_written(&mut alloc.extra, ptr, size)?; assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); assert_eq!(size.bytes() as usize as u64, size.bytes()); diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 19430c85cf7..6f8bbf3c4a9 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -24,7 +24,7 @@ use rustc::mir::interpret::{ GlobalId, AllocId, Allocation, Scalar, EvalResult, Pointer, PointerArithmetic }; use super::{ - EvalContext, Machine, AllocMap, + EvalContext, Machine, AllocMap, AllocationExtra, Immediate, ImmTy, ScalarMaybeUndef, Operand, OpTy, MemoryKind }; @@ -264,6 +264,7 @@ where Tag: ::std::fmt::Debug+Default+Copy+Eq+Hash+'static, M: Machine<'a, 'mir, 'tcx, PointerTag=Tag>, M::MemoryMap: AllocMap<AllocId, (MemoryKind<M::MemoryKinds>, Allocation<Tag, M::AllocExtra>)>, + M::AllocExtra: AllocationExtra<Tag>, { /// Take a value, which represents a (thin or fat) reference, and make it a place. /// Alignment is just based on the type. This is the inverse of `create_ref`. diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 8fde0c9b8af..84aa5b67566 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -17,7 +17,7 @@ use rustc::ty::layout::{self, Size, Align, TyLayout, LayoutOf}; use rustc::ty; use rustc_data_structures::fx::FxHashSet; use rustc::mir::interpret::{ - Scalar, AllocType, EvalResult, EvalErrorKind + Scalar, AllocType, EvalResult, EvalErrorKind, }; use super::{ |