]> git.lizzy.rs Git - rust.git/blobdiff - src/liballoc/alloc.rs
Rollup merge of #58183 - jethrogb:jb/alloc-box-guarantees, r=SimonSapin
[rust.git] / src / liballoc / alloc.rs
index 515de9852d1a6abf0b5c4066ba28678cd93b1cc0..f3877e51a6633f2589885ce08015fa5d0da46b85 100644 (file)
@@ -2,11 +2,9 @@
 
 #![stable(feature = "alloc_module", since = "1.28.0")]
 
-use core::{
-    intrinsics::{min_align_of_val, size_of_val},
-    ptr::{NonNull, Unique},
-    usize,
-};
+use core::intrinsics::{min_align_of_val, size_of_val};
+use core::ptr::{NonNull, Unique};
+use core::usize;
 
 #[stable(feature = "alloc_module", since = "1.28.0")]
 #[doc(inline)]
@@ -36,6 +34,9 @@ fn __rust_realloc(ptr: *mut u8,
 /// This type implements the [`Alloc`] trait by forwarding calls
 /// to the allocator registered with the `#[global_allocator]` attribute
 /// if there is one, or the `std` crate’s default.
+///
+/// Note: while this type is unstable, the functionality it provides can be
+/// accessed through the [free functions in `alloc`](index.html#functions).
 #[unstable(feature = "allocator_api", issue = "32838")]
 #[derive(Copy, Clone, Default, Debug)]
 pub struct Global;
@@ -230,10 +231,8 @@ pub fn handle_alloc_error(layout: Layout) -> ! {
 mod tests {
     extern crate test;
     use test::Bencher;
-    use crate::{
-        boxed::Box,
-        alloc::{Global, Alloc, Layout, handle_alloc_error},
-    };
+    use crate::boxed::Box;
+    use crate::alloc::{Global, Alloc, Layout, handle_alloc_error};
 
     #[test]
     fn allocate_zeroed() {