make memory allocation hook infallible
This commit is contained in:
parent
6cca7165ea
commit
53ed3b7956
@ -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 {
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)?))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user