Fix allocation of fn items by allowing ZST alignment to be 0.

This commit is contained in:
Scott Olson 2016-09-13 21:31:12 -06:00
parent 2e70fcdca8
commit f731766805

View File

@ -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,