diff options
| author | Ralf Jung <post@ralfj.de> | 2018-11-15 13:25:22 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-11-25 10:49:43 +0100 |
| commit | 53ed3b79562fdbcbb1ca073cb48a6fea1e23d51a (patch) | |
| tree | 0579f09faacc5ab3488e7a784975e171f76fe629 | |
| parent | 6cca7165ea60d1bd8b3347a68972b9c5bcbd2d5c (diff) | |
make memory allocation hook infallible
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/memory.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index b1e92ef4b51..d6c740794d5 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -59,7 +59,7 @@ pub trait AllocationExtra<Tag, MemoryExtra>: ::std::fmt::Debug + Clone { fn memory_allocated( _size: Size, _memory_extra: &MemoryExtra - ) -> EvalResult<'tcx, Self>; + ) -> Self; /// Hook for performing extra checks on a memory read access. /// @@ -102,8 +102,8 @@ impl AllocationExtra<(), ()> for () { fn memory_allocated( _size: Size, _memory_extra: &() - ) -> EvalResult<'tcx, Self> { - Ok(()) + ) -> Self { + () } } diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index b52feb41370..5c293bac74a 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -143,7 +143,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { align: Align, kind: MemoryKind<M::MemoryKinds>, ) -> EvalResult<'tcx, Pointer> { - let extra = AllocationExtra::memory_allocated(size, &self.extra)?; + let extra = AllocationExtra::memory_allocated(size, &self.extra); Ok(Pointer::from(self.allocate_with(Allocation::undef(size, align, extra), kind)?)) } |
