1
Fork 0

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::Entry::*;
use self::VacantEntryState::*; use self::VacantEntryState::*;
use alloc::heap::Heap;
use alloc::allocator::CollectionAllocErr;
use cell::Cell; use cell::Cell;
use core::heap::Alloc;
use borrow::Borrow; use borrow::Borrow;
use cmp::max; use cmp::max;
use fmt::{self, Debug}; use fmt::{self, Debug};
#[allow(deprecated)] #[allow(deprecated)]
use hash::{Hash, Hasher, BuildHasher, SipHasher13}; use hash::{Hash, Hasher, BuildHasher, SipHasher13};
use heap::{Heap, Alloc, CollectionAllocErr};
use iter::{FromIterator, FusedIterator}; use iter::{FromIterator, FusedIterator};
use mem::{self, replace}; use mem::{self, replace};
use ops::{Deref, Index}; use ops::{Deref, Index};

View file

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

View file

@ -424,13 +424,13 @@
#[doc(hidden)] #[doc(hidden)]
pub use ops::Bound; pub use ops::Bound;
#[stable(feature = "rust1", since = "1.0.0")] #[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")] #[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")] #[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")] #[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")] #[stable(feature = "rust1", since = "1.0.0")]
pub use self::hash_map::HashMap; pub use self::hash_map::HashMap;
@ -446,7 +446,7 @@ pub mod range {
} }
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub use alloc::allocator::CollectionAllocErr; pub use heap::CollectionAllocErr;
mod hash; mod hash;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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