Skip to content

Commit 1b895d8

Browse files
committed
Import the alloc crate as alloc_crate in std
… to make the name `alloc` available.
1 parent c660ced commit 1b895d8

File tree

18 files changed

+34
-40
lines changed

18 files changed

+34
-40
lines changed

src/libstd/collections/hash/map.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
use self::Entry::*;
1212
use self::VacantEntryState::*;
1313

14-
use alloc::heap::Heap;
15-
use alloc::allocator::CollectionAllocErr;
1614
use cell::Cell;
17-
use core::heap::Alloc;
1815
use borrow::Borrow;
1916
use cmp::max;
2017
use fmt::{self, Debug};
2118
#[allow(deprecated)]
2219
use hash::{Hash, Hasher, BuildHasher, SipHasher13};
20+
use heap::{Heap, Alloc, CollectionAllocErr};
2321
use iter::{FromIterator, FusedIterator};
2422
use mem::{self, replace};
2523
use ops::{Deref, Index};

src/libstd/collections/hash/table.rs

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

11-
use alloc::heap::Heap;
12-
use core::heap::{Alloc, Layout};
13-
1411
use cmp;
1512
use hash::{BuildHasher, Hash, Hasher};
13+
use heap::{Heap, Alloc, Layout, CollectionAllocErr};
1614
use marker;
1715
use mem::{align_of, size_of, needs_drop};
1816
use mem;
1917
use ops::{Deref, DerefMut};
2018
use ptr::{self, Unique, NonNull};
21-
use alloc::allocator::CollectionAllocErr;
2219

2320
use self::BucketState::*;
2421

src/libstd/collections/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,13 @@
424424
#[doc(hidden)]
425425
pub use ops::Bound;
426426
#[stable(feature = "rust1", since = "1.0.0")]
427-
pub use alloc::{BinaryHeap, BTreeMap, BTreeSet};
427+
pub use alloc_crate::{BinaryHeap, BTreeMap, BTreeSet};
428428
#[stable(feature = "rust1", since = "1.0.0")]
429-
pub use alloc::{LinkedList, VecDeque};
429+
pub use alloc_crate::{LinkedList, VecDeque};
430430
#[stable(feature = "rust1", since = "1.0.0")]
431-
pub use alloc::{binary_heap, btree_map, btree_set};
431+
pub use alloc_crate::{binary_heap, btree_map, btree_set};
432432
#[stable(feature = "rust1", since = "1.0.0")]
433-
pub use alloc::{linked_list, vec_deque};
433+
pub use alloc_crate::{linked_list, vec_deque};
434434

435435
#[stable(feature = "rust1", since = "1.0.0")]
436436
pub use self::hash_map::HashMap;
@@ -446,7 +446,7 @@ pub mod range {
446446
}
447447

448448
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
449-
pub use alloc::allocator::CollectionAllocErr;
449+
pub use heap::CollectionAllocErr;
450450

451451
mod hash;
452452

src/libstd/error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
// coherence challenge (e.g., specialization, neg impls, etc) we can
5252
// reconsider what crate these items belong in.
5353

54-
use alloc::allocator;
5554
use any::TypeId;
5655
use borrow::Cow;
5756
use cell;
5857
use char;
5958
use core::array;
6059
use fmt::{self, Debug, Display};
60+
use heap::{AllocErr, CannotReallocInPlace};
6161
use mem::transmute;
6262
use num;
6363
use str;
@@ -241,18 +241,18 @@ impl Error for ! {
241241
#[unstable(feature = "allocator_api",
242242
reason = "the precise API and guarantees it provides may be tweaked.",
243243
issue = "32838")]
244-
impl Error for allocator::AllocErr {
244+
impl Error for AllocErr {
245245
fn description(&self) -> &str {
246-
allocator::AllocErr::description(self)
246+
AllocErr::description(self)
247247
}
248248
}
249249

250250
#[unstable(feature = "allocator_api",
251251
reason = "the precise API and guarantees it provides may be tweaked.",
252252
issue = "32838")]
253-
impl Error for allocator::CannotReallocInPlace {
253+
impl Error for CannotReallocInPlace {
254254
fn description(&self) -> &str {
255-
allocator::CannotReallocInPlace::description(self)
255+
CannotReallocInPlace::description(self)
256256
}
257257
}
258258

src/libstd/heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
#![unstable(issue = "32838", feature = "allocator_api")]
1414

15-
pub use alloc::heap::Heap;
15+
pub use alloc_crate::heap::Heap;
1616
pub use alloc_system::System;
1717
#[doc(inline)] pub use core::heap::*;
1818

src/libstd/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ extern crate core as __core;
351351

352352
#[macro_use]
353353
#[macro_reexport(vec, format)]
354-
extern crate alloc;
354+
extern crate alloc as alloc_crate;
355355
extern crate alloc_system;
356356
#[doc(masked)]
357357
extern crate libc;
@@ -437,21 +437,21 @@ pub use core::u32;
437437
#[stable(feature = "rust1", since = "1.0.0")]
438438
pub use core::u64;
439439
#[stable(feature = "rust1", since = "1.0.0")]
440-
pub use alloc::boxed;
440+
pub use alloc_crate::boxed;
441441
#[stable(feature = "rust1", since = "1.0.0")]
442-
pub use alloc::rc;
442+
pub use alloc_crate::rc;
443443
#[stable(feature = "rust1", since = "1.0.0")]
444-
pub use alloc::borrow;
444+
pub use alloc_crate::borrow;
445445
#[stable(feature = "rust1", since = "1.0.0")]
446-
pub use alloc::fmt;
446+
pub use alloc_crate::fmt;
447447
#[stable(feature = "rust1", since = "1.0.0")]
448-
pub use alloc::slice;
448+
pub use alloc_crate::slice;
449449
#[stable(feature = "rust1", since = "1.0.0")]
450-
pub use alloc::str;
450+
pub use alloc_crate::str;
451451
#[stable(feature = "rust1", since = "1.0.0")]
452-
pub use alloc::string;
452+
pub use alloc_crate::string;
453453
#[stable(feature = "rust1", since = "1.0.0")]
454-
pub use alloc::vec;
454+
pub use alloc_crate::vec;
455455
#[stable(feature = "rust1", since = "1.0.0")]
456456
pub use core::char;
457457
#[stable(feature = "i128", since = "1.26.0")]

src/libstd/sync/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![stable(feature = "rust1", since = "1.0.0")]
1919

2020
#[stable(feature = "rust1", since = "1.0.0")]
21-
pub use alloc::arc::{Arc, Weak};
21+
pub use alloc_crate::arc::{Arc, Weak};
2222
#[stable(feature = "rust1", since = "1.0.0")]
2323
pub use core::sync::atomic;
2424

src/libstd/sync/mpsc/mpsc_queue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323

2424
pub use self::PopResult::*;
2525

26-
use alloc::boxed::Box;
2726
use core::ptr;
2827
use core::cell::UnsafeCell;
29-
28+
use boxed::Box;
3029
use sync::atomic::{AtomicPtr, Ordering};
3130

3231
/// A result of the `pop` function.

src/libstd/sync/mpsc/spsc_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
// http://www.1024cores.net/home/lock-free-algorithms/queues/unbounded-spsc-queue
1818

19-
use alloc::boxed::Box;
19+
use boxed::Box;
2020
use core::ptr;
2121
use core::cell::UnsafeCell;
2222

src/libstd/sys/cloudabi/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use alloc::boxed::FnBox;
11+
use boxed::FnBox;
1212
use cmp;
1313
use ffi::CStr;
1414
use io;

0 commit comments

Comments
 (0)