Fix allocation of fn items by allowing ZST alignment to be 0.
This commit is contained in:
parent
2e70fcdca8
commit
f731766805
@ -173,10 +173,11 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn allocate(&mut self, size: usize, align: usize) -> EvalResult<'tcx, Pointer> {
|
pub fn allocate(&mut self, size: usize, align: usize) -> EvalResult<'tcx, Pointer> {
|
||||||
assert!(align != 0);
|
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
return Ok(Pointer::zst_ptr());
|
return Ok(Pointer::zst_ptr());
|
||||||
}
|
}
|
||||||
|
assert!(align != 0);
|
||||||
|
|
||||||
if self.memory_size - self.memory_usage < size {
|
if self.memory_size - self.memory_usage < size {
|
||||||
return Err(EvalError::OutOfMemory {
|
return Err(EvalError::OutOfMemory {
|
||||||
allocation_size: size,
|
allocation_size: size,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user