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 @@ fn create_fn_alloc(&mut self, def: FunctionDefinition<'tcx>) -> Pointer {
|
||||
}
|
||||
|
||||
pub fn allocate(&mut self, size: usize, align: usize) -> EvalResult<'tcx, Pointer> {
|
||||
assert!(align != 0);
|
||||
if size == 0 {
|
||||
return Ok(Pointer::zst_ptr());
|
||||
}
|
||||
assert!(align != 0);
|
||||
|
||||
if self.memory_size - self.memory_usage < size {
|
||||
return Err(EvalError::OutOfMemory {
|
||||
allocation_size: size,
|
||||
|
Loading…
Reference in New Issue
Block a user