about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-04-14 18:48:09 +0800
committerkennytm <kennytm@gmail.com>2018-04-14 18:48:09 +0800
commit9659f052a44659f30c31f889cba0ad2ba8d8372c (patch)
tree89ff142e811afde6e4974177bdc83328cefce91d
parente681ba22d2b802578388c7753003aeda442bcca4 (diff)
parente35499ca15c205a0d6e6d579a69e1100ca8e585b (diff)
downloadrust-9659f052a44659f30c31f889cba0ad2ba8d8372c.tar.gz
rust-9659f052a44659f30c31f889cba0ad2ba8d8372c.zip
Rollup merge of #49958 - glandium:cleanup, r=SimonSapin
Cleanup liballoc use statements

Some modules were still using the deprecated `allocator` module, use the
`alloc` module instead.

Some modules were using `super` while it's not needed.

Some modules were more or less ordering them, and other not, so the
latter have been modified to match the others.
-rw-r--r--src/doc/unstable-book/src/language-features/global-allocator.md2
-rw-r--r--src/liballoc/boxed.rs4
-rw-r--r--src/liballoc/raw_vec.rs9
-rw-r--r--src/liballoc/str.rs6
-rw-r--r--src/liballoc/string.rs4
-rw-r--r--src/liballoc/vec.rs2
-rw-r--r--src/liballoc/vec_deque.rs5
-rw-r--r--src/test/compile-fail/allocator/auxiliary/system-allocator.rs2
-rw-r--r--src/test/compile-fail/allocator/auxiliary/system-allocator2.rs2
-rw-r--r--src/test/compile-fail/allocator/two-allocators.rs2
-rw-r--r--src/test/compile-fail/allocator/two-allocators2.rs2
-rw-r--r--src/test/run-pass/allocator-alloc-one.rs8
-rw-r--r--src/test/run-pass/allocator/auxiliary/custom.rs2
-rw-r--r--src/test/run-pass/regions-mock-trans.rs8
-rw-r--r--src/test/run-pass/thin-lto-global-allocator.rs2
15 files changed, 30 insertions, 30 deletions
diff --git a/src/doc/unstable-book/src/language-features/global-allocator.md b/src/doc/unstable-book/src/language-features/global-allocator.md
index 031b6347445..8f1ba22de8c 100644
--- a/src/doc/unstable-book/src/language-features/global-allocator.md
+++ b/src/doc/unstable-book/src/language-features/global-allocator.md
@@ -55,7 +55,7 @@ fn main() {
 ```
 
 And that's it! The `#[global_allocator]` attribute is applied to a `static`
-which implements the `Alloc` trait in the `std::heap` module. Note, though,
+which implements the `Alloc` trait in the `std::alloc` module. Note, though,
 that the implementation is defined for `&MyAllocator`, not just `MyAllocator`.
 You may wish, however, to also provide `Alloc for MyAllocator` for other use
 cases.
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 71b53cc88e5..aceb6ff8abe 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -55,8 +55,6 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
-use raw_vec::RawVec;
-
 use core::any::Any;
 use core::borrow;
 use core::cmp::Ordering;
@@ -68,6 +66,8 @@ use core::mem::{self, Pin};
 use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
 use core::ptr::{self, NonNull, Unique};
 use core::convert::From;
+
+use raw_vec::RawVec;
 use str::from_boxed_utf8_unchecked;
 
 /// A pointer type for heap allocation.
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index 214cc7d7d0c..405814c021a 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -8,15 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use alloc::{Alloc, Layout, Global};
 use core::cmp;
 use core::mem;
 use core::ops::Drop;
 use core::ptr::{self, NonNull, Unique};
 use core::slice;
-use super::boxed::Box;
-use super::allocator::CollectionAllocErr;
-use super::allocator::CollectionAllocErr::*;
+
+use alloc::{Alloc, Layout, Global};
+use alloc::CollectionAllocErr;
+use alloc::CollectionAllocErr::*;
+use boxed::Box;
 
 /// A low-level utility for more ergonomically allocating, reallocating, and deallocating
 /// a buffer of memory on the heap without having to worry about all the corner cases
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs
index 65df93bd3bb..6c9f3dd7ec9 100644
--- a/src/liballoc/str.rs
+++ b/src/liballoc/str.rs
@@ -46,12 +46,12 @@ use core::mem;
 use core::ptr;
 use core::iter::FusedIterator;
 
-use vec_deque::VecDeque;
 use borrow::{Borrow, ToOwned};
+use boxed::Box;
+use slice::{SliceConcatExt, SliceIndex};
 use string::String;
 use vec::Vec;
-use slice::{SliceConcatExt, SliceIndex};
-use boxed::Box;
+use vec_deque::VecDeque;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::str::{FromStr, Utf8Error};
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 29d759b1f00..0924ca24791 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -66,11 +66,11 @@ use core::ptr;
 use core::str::pattern::Pattern;
 use core::str::lossy;
 
+use alloc::CollectionAllocErr;
 use borrow::{Cow, ToOwned};
+use boxed::Box;
 use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
 use vec::Vec;
-use boxed::Box;
-use super::allocator::CollectionAllocErr;
 
 /// A UTF-8 encoded, growable string.
 ///
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 0f74743ca49..9ae415c328b 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -82,11 +82,11 @@ use core::ptr;
 use core::ptr::NonNull;
 use core::slice;
 
+use alloc::CollectionAllocErr;
 use borrow::ToOwned;
 use borrow::Cow;
 use boxed::Box;
 use raw_vec::RawVec;
-use super::allocator::CollectionAllocErr;
 
 /// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
 ///
diff --git a/src/liballoc/vec_deque.rs b/src/liballoc/vec_deque.rs
index f28c8e38996..603e38ca2ca 100644
--- a/src/liballoc/vec_deque.rs
+++ b/src/liballoc/vec_deque.rs
@@ -30,10 +30,9 @@ use core::slice;
 use core::hash::{Hash, Hasher};
 use core::cmp;
 
+use alloc::CollectionAllocErr;
 use raw_vec::RawVec;
-
-use super::allocator::CollectionAllocErr;
-use super::vec::Vec;
+use vec::Vec;
 
 const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
 const MINIMUM_CAPACITY: usize = 1; // 2 - 1
diff --git a/src/test/compile-fail/allocator/auxiliary/system-allocator.rs b/src/test/compile-fail/allocator/auxiliary/system-allocator.rs
index 4761dc421d7..37e64ba7ea1 100644
--- a/src/test/compile-fail/allocator/auxiliary/system-allocator.rs
+++ b/src/test/compile-fail/allocator/auxiliary/system-allocator.rs
@@ -13,7 +13,7 @@
 #![feature(global_allocator, allocator_api)]
 #![crate_type = "rlib"]
 
-use std::heap::System;
+use std::alloc::System;
 
 #[global_allocator]
 static A: System = System;
diff --git a/src/test/compile-fail/allocator/auxiliary/system-allocator2.rs b/src/test/compile-fail/allocator/auxiliary/system-allocator2.rs
index 4761dc421d7..37e64ba7ea1 100644
--- a/src/test/compile-fail/allocator/auxiliary/system-allocator2.rs
+++ b/src/test/compile-fail/allocator/auxiliary/system-allocator2.rs
@@ -13,7 +13,7 @@
 #![feature(global_allocator, allocator_api)]
 #![crate_type = "rlib"]
 
-use std::heap::System;
+use std::alloc::System;
 
 #[global_allocator]
 static A: System = System;
diff --git a/src/test/compile-fail/allocator/two-allocators.rs b/src/test/compile-fail/allocator/two-allocators.rs
index b46ba6334a2..5aa6b5d6777 100644
--- a/src/test/compile-fail/allocator/two-allocators.rs
+++ b/src/test/compile-fail/allocator/two-allocators.rs
@@ -10,7 +10,7 @@
 
 #![feature(global_allocator, allocator_api)]
 
-use std::heap::System;
+use std::alloc::System;
 
 #[global_allocator]
 static A: System = System;
diff --git a/src/test/compile-fail/allocator/two-allocators2.rs b/src/test/compile-fail/allocator/two-allocators2.rs
index e342c1f9c44..ec5d985a943 100644
--- a/src/test/compile-fail/allocator/two-allocators2.rs
+++ b/src/test/compile-fail/allocator/two-allocators2.rs
@@ -16,7 +16,7 @@
 
 extern crate system_allocator;
 
-use std::heap::System;
+use std::alloc::System;
 
 #[global_allocator]
 static A: System = System;
diff --git a/src/test/run-pass/allocator-alloc-one.rs b/src/test/run-pass/allocator-alloc-one.rs
index 38b8ab50cc7..d4fcdcf743b 100644
--- a/src/test/run-pass/allocator-alloc-one.rs
+++ b/src/test/run-pass/allocator-alloc-one.rs
@@ -10,15 +10,15 @@
 
 #![feature(allocator_api, nonnull)]
 
-use std::heap::{Heap, Alloc};
+use std::alloc::{Alloc, Global};
 
 fn main() {
     unsafe {
-        let ptr = Heap.alloc_one::<i32>().unwrap_or_else(|_| {
-            Heap.oom()
+        let ptr = Global.alloc_one::<i32>().unwrap_or_else(|_| {
+            Global.oom()
         });
         *ptr.as_ptr() = 4;
         assert_eq!(*ptr.as_ptr(), 4);
-        Heap.dealloc_one(ptr);
+        Global.dealloc_one(ptr);
     }
 }
diff --git a/src/test/run-pass/allocator/auxiliary/custom.rs b/src/test/run-pass/allocator/auxiliary/custom.rs
index e6a2e22983b..91f70aa83e8 100644
--- a/src/test/run-pass/allocator/auxiliary/custom.rs
+++ b/src/test/run-pass/allocator/auxiliary/custom.rs
@@ -13,7 +13,7 @@
 #![feature(heap_api, allocator_api)]
 #![crate_type = "rlib"]
 
-use std::heap::{GlobalAlloc, System, Layout, Opaque};
+use std::alloc::{GlobalAlloc, System, Layout, Opaque};
 use std::sync::atomic::{AtomicUsize, Ordering};
 
 pub struct A(pub AtomicUsize);
diff --git a/src/test/run-pass/regions-mock-trans.rs b/src/test/run-pass/regions-mock-trans.rs
index 3c37243c8b9..44be59f5c5b 100644
--- a/src/test/run-pass/regions-mock-trans.rs
+++ b/src/test/run-pass/regions-mock-trans.rs
@@ -12,7 +12,7 @@
 
 #![feature(allocator_api)]
 
-use std::heap::{Alloc, Heap, Layout};
+use std::alloc::{Alloc, Global, Layout};
 use std::ptr::NonNull;
 
 struct arena(());
@@ -32,8 +32,8 @@ struct Ccx {
 
 fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> {
     unsafe {
-        let ptr = Heap.alloc(Layout::new::<Bcx>())
-            .unwrap_or_else(|_| Heap.oom());
+        let ptr = Global.alloc(Layout::new::<Bcx>())
+            .unwrap_or_else(|_| Global.oom());
         &*(ptr.as_ptr() as *const _)
     }
 }
@@ -46,7 +46,7 @@ fn g(fcx : &Fcx) {
     let bcx = Bcx { fcx: fcx };
     let bcx2 = h(&bcx);
     unsafe {
-        Heap.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
+        Global.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
     }
 }
 
diff --git a/src/test/run-pass/thin-lto-global-allocator.rs b/src/test/run-pass/thin-lto-global-allocator.rs
index 1c15da5469e..a0534ff6735 100644
--- a/src/test/run-pass/thin-lto-global-allocator.rs
+++ b/src/test/run-pass/thin-lto-global-allocator.rs
@@ -14,6 +14,6 @@
 #![feature(allocator_api, global_allocator)]
 
 #[global_allocator]
-static A: std::heap::System = std::heap::System;
+static A: std::alloc::System = std::alloc::System;
 
 fn main() {}