diff options
| author | Tim Diekmann <tim.diekmann@3dvision.de> | 2020-03-24 11:45:38 +0100 |
|---|---|---|
| committer | Tim Diekmann <tim.diekmann@3dvision.de> | 2020-03-26 17:10:54 +0100 |
| commit | 56cbf2f22aeb6448acd7eb49e9b2554c80bdbf79 (patch) | |
| tree | af24a0972cda1bd07560e36c5edd5aa14b53fc7d /src/liballoc/raw_vec | |
| parent | 2fbb07525e2f07a815e780a4268b11916248b5a9 (diff) | |
| download | rust-56cbf2f22aeb6448acd7eb49e9b2554c80bdbf79.tar.gz rust-56cbf2f22aeb6448acd7eb49e9b2554c80bdbf79.zip | |
Overhaul of the `AllocRef` trait to match allocator-wg's latest consens
Diffstat (limited to 'src/liballoc/raw_vec')
| -rw-r--r-- | src/liballoc/raw_vec/tests.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/liballoc/raw_vec/tests.rs b/src/liballoc/raw_vec/tests.rs index 21a8a76d0a7..a2d6cc63c92 100644 --- a/src/liballoc/raw_vec/tests.rs +++ b/src/liballoc/raw_vec/tests.rs @@ -1,4 +1,5 @@ use super::*; +use core::ptr::NonNull; #[test] fn allocator_param() { @@ -20,12 +21,16 @@ fn allocator_param() { fuel: usize, } unsafe impl AllocRef for BoundedAlloc { - fn alloc(&mut self, layout: Layout) -> Result<(NonNull<u8>, usize), AllocErr> { + fn alloc( + &mut self, + layout: Layout, + init: AllocInit, + ) -> Result<(NonNull<u8>, usize), AllocErr> { let size = layout.size(); if size > self.fuel { return Err(AllocErr); } - match Global.alloc(layout) { + match Global.alloc(layout, init) { ok @ Ok(_) => { self.fuel -= size; ok |
