Make AllocErr a zero-size unit struct
This commit is contained in:
parent
a4caac5e93
commit
ba7081a033
7 changed files with 51 additions and 135 deletions
|
@ -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 }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue