Skip to content

Commit

Permalink
Use given allocator instad of Global
Browse files Browse the repository at this point in the history
  • Loading branch information
AljoschaMeyer authored Jul 22, 2024
1 parent 497ef49 commit 351fe27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ impl<T, A: Allocator> Box<[T], A> {
Ok(l) => l,
Err(_) => return Err(AllocError),
};
Global.allocate(layout)?.cast()
alloc.allocate(layout)?.cast()
};
unsafe { Ok(RawVec::from_raw_parts_in(ptr.as_ptr(), len, alloc).into_box(len)) }
}
Expand Down Expand Up @@ -906,7 +906,7 @@ impl<T, A: Allocator> Box<[T], A> {
Ok(l) => l,
Err(_) => return Err(AllocError),
};
Global.allocate_zeroed(layout)?.cast()
alloc.allocate_zeroed(layout)?.cast()
};
unsafe { Ok(RawVec::from_raw_parts_in(ptr.as_ptr(), len, alloc).into_box(len)) }
}
Expand Down

0 comments on commit 351fe27

Please sign in to comment.