1
Fork 0

Make AllocErr a zero-size unit struct

This commit is contained in:
Simon Sapin 2018-04-03 15:41:09 +02:00
parent a4caac5e93
commit ba7081a033
7 changed files with 51 additions and 135 deletions

View file

@ -760,7 +760,7 @@ mod tests {
unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
let size = layout.size();
if size > self.fuel {
return Err(AllocErr::Unsupported { details: "fuel exhausted" });
return Err(AllocErr);
}
match Global.alloc(layout) {
ok @ Ok(_) => { self.fuel -= size; ok }