Skip to content

Commit 9659f05

Browse files
committed
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.
2 parents e681ba2 + e35499c commit 9659f05

File tree

15 files changed

+30
-30
lines changed

15 files changed

+30
-30
lines changed

src/doc/unstable-book/src/language-features/global-allocator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn main() {
5555
```
5656

5757
And that's it! The `#[global_allocator]` attribute is applied to a `static`
58-
which implements the `Alloc` trait in the `std::heap` module. Note, though,
58+
which implements the `Alloc` trait in the `std::alloc` module. Note, though,
5959
that the implementation is defined for `&MyAllocator`, not just `MyAllocator`.
6060
You may wish, however, to also provide `Alloc for MyAllocator` for other use
6161
cases.

src/liballoc/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
5656
#![stable(feature = "rust1", since = "1.0.0")]
5757

58-
use raw_vec::RawVec;
59-
6058
use core::any::Any;
6159
use core::borrow;
6260
use core::cmp::Ordering;
@@ -68,6 +66,8 @@ use core::mem::{self, Pin};
6866
use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
6967
use core::ptr::{self, NonNull, Unique};
7068
use core::convert::From;
69+
70+
use raw_vec::RawVec;
7171
use str::from_boxed_utf8_unchecked;
7272

7373
/// A pointer type for heap allocation.

src/liballoc/raw_vec.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use alloc::{Alloc, Layout, Global};
1211
use core::cmp;
1312
use core::mem;
1413
use core::ops::Drop;
1514
use core::ptr::{self, NonNull, Unique};
1615
use core::slice;
17-
use super::boxed::Box;
18-
use super::allocator::CollectionAllocErr;
19-
use super::allocator::CollectionAllocErr::*;
16+
17+
use alloc::{Alloc, Layout, Global};
18+
use alloc::CollectionAllocErr;
19+
use alloc::CollectionAllocErr::*;
20+
use boxed::Box;
2021

2122
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
2223
/// a buffer of memory on the heap without having to worry about all the corner cases

src/liballoc/str.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ use core::mem;
4646
use core::ptr;
4747
use core::iter::FusedIterator;
4848

49-
use vec_deque::VecDeque;
5049
use borrow::{Borrow, ToOwned};
50+
use boxed::Box;
51+
use slice::{SliceConcatExt, SliceIndex};
5152
use string::String;
5253
use vec::Vec;
53-
use slice::{SliceConcatExt, SliceIndex};
54-
use boxed::Box;
54+
use vec_deque::VecDeque;
5555

5656
#[stable(feature = "rust1", since = "1.0.0")]
5757
pub use core::str::{FromStr, Utf8Error};

src/liballoc/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ use core::ptr;
6666
use core::str::pattern::Pattern;
6767
use core::str::lossy;
6868

69+
use alloc::CollectionAllocErr;
6970
use borrow::{Cow, ToOwned};
71+
use boxed::Box;
7072
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
7173
use vec::Vec;
72-
use boxed::Box;
73-
use super::allocator::CollectionAllocErr;
7474

7575
/// A UTF-8 encoded, growable string.
7676
///

src/liballoc/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ use core::ptr;
8282
use core::ptr::NonNull;
8383
use core::slice;
8484

85+
use alloc::CollectionAllocErr;
8586
use borrow::ToOwned;
8687
use borrow::Cow;
8788
use boxed::Box;
8889
use raw_vec::RawVec;
89-
use super::allocator::CollectionAllocErr;
9090

9191
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
9292
///

src/liballoc/vec_deque.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ use core::slice;
3030
use core::hash::{Hash, Hasher};
3131
use core::cmp;
3232

33+
use alloc::CollectionAllocErr;
3334
use raw_vec::RawVec;
34-
35-
use super::allocator::CollectionAllocErr;
36-
use super::vec::Vec;
35+
use vec::Vec;
3736

3837
const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
3938
const MINIMUM_CAPACITY: usize = 1; // 2 - 1

src/test/compile-fail/allocator/auxiliary/system-allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![feature(global_allocator, allocator_api)]
1414
#![crate_type = "rlib"]
1515

16-
use std::heap::System;
16+
use std::alloc::System;
1717

1818
#[global_allocator]
1919
static A: System = System;

src/test/compile-fail/allocator/auxiliary/system-allocator2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![feature(global_allocator, allocator_api)]
1414
#![crate_type = "rlib"]
1515

16-
use std::heap::System;
16+
use std::alloc::System;
1717

1818
#[global_allocator]
1919
static A: System = System;

src/test/compile-fail/allocator/two-allocators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![feature(global_allocator, allocator_api)]
1212

13-
use std::heap::System;
13+
use std::alloc::System;
1414

1515
#[global_allocator]
1616
static A: System = System;

0 commit comments

Comments
 (0)