]> git.lizzy.rs Git - rust.git/commitdiff
make memory allocation hook infallible
authorRalf Jung <post@ralfj.de>
Thu, 15 Nov 2018 12:25:22 +0000 (13:25 +0100)
committerRalf Jung <post@ralfj.de>
Sun, 25 Nov 2018 09:49:43 +0000 (10:49 +0100)
src/librustc/mir/interpret/allocation.rs
src/librustc_mir/interpret/memory.rs

index b1e92ef4b51182d13048d0ce58dc035a6ba92726..d6c740794d51750295acc194065f0faeeda78d88 100644 (file)
@@ -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 {
+        ()
     }
 }
 
index b52feb41370d3f9dec16c78b3d146553ace15369..5c293bac74ad984e624587e82fd1bfde77009b86 100644 (file)
@@ -143,7 +143,7 @@ pub fn allocate(
         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)?))
     }