make memory allocation hook infallible

This commit is contained in:
Ralf Jung 2018-11-15 13:25:22 +01:00
parent 6cca7165ea
commit 53ed3b7956
2 changed files with 4 additions and 4 deletions

View 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 {
()
}
}

View 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)?))
}