Skip to content

Commit 53ed3b7

Browse files
committed
make memory allocation hook infallible
1 parent 6cca716 commit 53ed3b7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc/mir/interpret/allocation.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub trait AllocationExtra<Tag, MemoryExtra>: ::std::fmt::Debug + Clone {
5959
fn memory_allocated(
6060
_size: Size,
6161
_memory_extra: &MemoryExtra
62-
) -> EvalResult<'tcx, Self>;
62+
) -> Self;
6363

6464
/// Hook for performing extra checks on a memory read access.
6565
///
@@ -102,8 +102,8 @@ impl AllocationExtra<(), ()> for () {
102102
fn memory_allocated(
103103
_size: Size,
104104
_memory_extra: &()
105-
) -> EvalResult<'tcx, Self> {
106-
Ok(())
105+
) -> Self {
106+
()
107107
}
108108
}
109109

src/librustc_mir/interpret/memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
143143
align: Align,
144144
kind: MemoryKind<M::MemoryKinds>,
145145
) -> EvalResult<'tcx, Pointer> {
146-
let extra = AllocationExtra::memory_allocated(size, &self.extra)?;
146+
let extra = AllocationExtra::memory_allocated(size, &self.extra);
147147
Ok(Pointer::from(self.allocate_with(Allocation::undef(size, align, extra), kind)?))
148148
}
149149

0 commit comments

Comments
 (0)