]> git.lizzy.rs Git - rust.git/blobdiff - src/liballoc/raw_vec/tests.rs
Overhaul of the `AllocRef` trait to match allocator-wg's latest consens
[rust.git] / src / liballoc / raw_vec / tests.rs
index 21a8a76d0a75b179b8c7d5208f432d1295d57654..a2d6cc63c92f4e43030aca89b88ef87e54c7c5d9 100644 (file)
@@ -1,4 +1,5 @@
 use super::*;
+use core::ptr::NonNull;
 
 #[test]
 fn allocator_param() {
@@ -20,12 +21,16 @@ struct BoundedAlloc {
         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