Import the alloc crate as alloc_crate in std

… to make the name `alloc` available.
This commit is contained in:
Simon Sapin 2018-04-03 14:36:57 +02:00
parent c660cedc02
commit 1b895d8b88
18 changed files with 34 additions and 40 deletions

View File

@ -11,15 +11,13 @@
use self::Entry::*;
use self::VacantEntryState::*;
use alloc::heap::Heap;
use alloc::allocator::CollectionAllocErr;
use cell::Cell;
use core::heap::Alloc;
use borrow::Borrow;
use cmp::max;
use fmt::{self, Debug};
#[allow(deprecated)]
use hash::{Hash, Hasher, BuildHasher, SipHasher13};
use heap::{Heap, Alloc, CollectionAllocErr};
use iter::{FromIterator, FusedIterator};
use mem::{self, replace};
use ops::{Deref, Index};

View File

@ -8,17 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::heap::Heap;
use core::heap::{Alloc, Layout};
use cmp;
use hash::{BuildHasher, Hash, Hasher};
use heap::{Heap, Alloc, Layout, CollectionAllocErr};
use marker;
use mem::{align_of, size_of, needs_drop};
use mem;
use ops::{Deref, DerefMut};
use ptr::{self, Unique, NonNull};
use alloc::allocator::CollectionAllocErr;
use self::BucketState::*;

View File

@ -424,13 +424,13 @@
#[doc(hidden)]
pub use ops::Bound;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::{BinaryHeap, BTreeMap, BTreeSet};
pub use alloc_crate::{BinaryHeap, BTreeMap, BTreeSet};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::{LinkedList, VecDeque};
pub use alloc_crate::{LinkedList, VecDeque};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::{binary_heap, btree_map, btree_set};
pub use alloc_crate::{binary_heap, btree_map, btree_set};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::{linked_list, vec_deque};
pub use alloc_crate::{linked_list, vec_deque};
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::hash_map::HashMap;
@ -446,7 +446,7 @@ pub mod range {
}
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub use alloc::allocator::CollectionAllocErr;
pub use heap::CollectionAllocErr;
mod hash;

View File

@ -51,13 +51,13 @@
// coherence challenge (e.g., specialization, neg impls, etc) we can
// reconsider what crate these items belong in.
use alloc::allocator;
use any::TypeId;
use borrow::Cow;
use cell;
use char;
use core::array;
use fmt::{self, Debug, Display};
use heap::{AllocErr, CannotReallocInPlace};
use mem::transmute;
use num;
use str;
@ -241,18 +241,18 @@ impl Error for ! {
#[unstable(feature = "allocator_api",
reason = "the precise API and guarantees it provides may be tweaked.",
issue = "32838")]
impl Error for allocator::AllocErr {
impl Error for AllocErr {
fn description(&self) -> &str {
allocator::AllocErr::description(self)
AllocErr::description(self)
}
}
#[unstable(feature = "allocator_api",
reason = "the precise API and guarantees it provides may be tweaked.",
issue = "32838")]
impl Error for allocator::CannotReallocInPlace {
impl Error for CannotReallocInPlace {
fn description(&self) -> &str {
allocator::CannotReallocInPlace::description(self)
CannotReallocInPlace::description(self)
}
}

View File

@ -12,7 +12,7 @@
#![unstable(issue = "32838", feature = "allocator_api")]
pub use alloc::heap::Heap;
pub use alloc_crate::heap::Heap;
pub use alloc_system::System;
#[doc(inline)] pub use core::heap::*;

View File

@ -351,7 +351,7 @@ extern crate core as __core;
#[macro_use]
#[macro_reexport(vec, format)]
extern crate alloc;
extern crate alloc as alloc_crate;
extern crate alloc_system;
#[doc(masked)]
extern crate libc;
@ -437,21 +437,21 @@ pub use core::u32;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::u64;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::boxed;
pub use alloc_crate::boxed;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::rc;
pub use alloc_crate::rc;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::borrow;
pub use alloc_crate::borrow;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::fmt;
pub use alloc_crate::fmt;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::slice;
pub use alloc_crate::slice;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::str;
pub use alloc_crate::str;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::string;
pub use alloc_crate::string;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::vec;
pub use alloc_crate::vec;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::char;
#[stable(feature = "i128", since = "1.26.0")]

View File

@ -18,7 +18,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::arc::{Arc, Weak};
pub use alloc_crate::arc::{Arc, Weak};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::sync::atomic;

View File

@ -23,10 +23,9 @@
pub use self::PopResult::*;
use alloc::boxed::Box;
use core::ptr;
use core::cell::UnsafeCell;
use boxed::Box;
use sync::atomic::{AtomicPtr, Ordering};
/// A result of the `pop` function.

View File

@ -16,7 +16,7 @@
// http://www.1024cores.net/home/lock-free-algorithms/queues/unbounded-spsc-queue
use alloc::boxed::Box;
use boxed::Box;
use core::ptr;
use core::cell::UnsafeCell;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::boxed::FnBox;
use boxed::FnBox;
use cmp;
use ffi::CStr;
use io;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::boxed::FnBox;
use boxed::FnBox;
use ffi::CStr;
use io;
use mem;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::boxed::FnBox;
use boxed::FnBox;
use cmp;
use ffi::CStr;
use io;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::boxed::FnBox;
use boxed::FnBox;
use ffi::CStr;
use io;
use sys::{unsupported, Void};

View File

@ -31,7 +31,7 @@ use sys::stdio;
use sys::cvt;
use sys_common::{AsInner, FromInner, IntoInner};
use sys_common::process::{CommandEnv, EnvKey};
use alloc::borrow::Borrow;
use borrow::Borrow;
////////////////////////////////////////////////////////////////////////////////
// Command

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::boxed::FnBox;
use boxed::FnBox;
use io;
use ffi::CStr;
use mem;

View File

@ -12,7 +12,7 @@
//!
//! Documentation can be found on the `rt::at_exit` function.
use alloc::boxed::FnBox;
use boxed::FnBox;
use ptr;
use sys_common::mutex::Mutex;

View File

@ -14,7 +14,7 @@
use ffi::{OsStr, OsString};
use env;
use collections::BTreeMap;
use alloc::borrow::Borrow;
use borrow::Borrow;
pub trait EnvKey:
From<OsString> + Into<OsString> +

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::boxed::FnBox;
use boxed::FnBox;
use env;
use sync::atomic::{self, Ordering};
use sys::stack_overflow;