diff options
| author | kennytm <kennytm@gmail.com> | 2019-03-16 14:56:18 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-16 14:56:18 +0800 |
| commit | 382dfeab854d74f221e95d5870a203eb226d3c0f (patch) | |
| tree | a1c38a1374a0d61ccccbe51a6e831a15d5e12322 /src/liballoc | |
| parent | ccbf754e351da26f48c76f228831cd12c064053d (diff) | |
| parent | 5d1022ad7b82168aee243d2adcbd83d1e886586f (diff) | |
| download | rust-382dfeab854d74f221e95d5870a203eb226d3c0f.tar.gz rust-382dfeab854d74f221e95d5870a203eb226d3c0f.zip | |
Rollup merge of #58933 - SimonSapin:alloc-prelude-v1, r=Amanieu
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std This was one of the unresolved questions of https://github.com/rust-lang/rfcs/pull/2480. As the RFC says this is maybe not useful in the sense that we are unlikely to ever have a second version, but making the crate a true subset makes one less issue to think about if we stabilize it and later want to merge standard library crates and have Cargo feature flags to enable or disable parts of the `std` crate. See also discussion in https://github.com/rust-lang/rust/pull/58175. Also rename the feature gate and point to a dedicated tracking issue: https://github.com/rust-lang/rust/issues/58935
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/prelude.rs | 19 | ||||
| -rw-r--r-- | src/liballoc/prelude/mod.rs | 16 | ||||
| -rw-r--r-- | src/liballoc/prelude/v1.rs | 11 |
3 files changed, 27 insertions, 19 deletions
diff --git a/src/liballoc/prelude.rs b/src/liballoc/prelude.rs deleted file mode 100644 index 6767cf89f73..00000000000 --- a/src/liballoc/prelude.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! The alloc Prelude -//! -//! The purpose of this module is to alleviate imports of commonly-used -//! items of the `alloc` crate by adding a glob import to the top of modules: -//! -//! ``` -//! # #![allow(unused_imports)] -//! # #![feature(alloc)] -//! extern crate alloc; -//! use alloc::prelude::*; -//! ``` - -#![unstable(feature = "alloc", issue = "27783")] - -#[unstable(feature = "alloc", issue = "27783")] pub use crate::borrow::ToOwned; -#[unstable(feature = "alloc", issue = "27783")] pub use crate::boxed::Box; -#[unstable(feature = "alloc", issue = "27783")] pub use crate::slice::SliceConcatExt; -#[unstable(feature = "alloc", issue = "27783")] pub use crate::string::{String, ToString}; -#[unstable(feature = "alloc", issue = "27783")] pub use crate::vec::Vec; diff --git a/src/liballoc/prelude/mod.rs b/src/liballoc/prelude/mod.rs new file mode 100644 index 00000000000..33cc51d1732 --- /dev/null +++ b/src/liballoc/prelude/mod.rs @@ -0,0 +1,16 @@ +//! The alloc Prelude +//! +//! The purpose of this module is to alleviate imports of commonly-used +//! items of the `alloc` crate by adding a glob import to the top of modules: +//! +//! ``` +//! # #![allow(unused_imports)] +//! # #![feature(alloc)] +//! #![feature(alloc_prelude)] +//! extern crate alloc; +//! use alloc::prelude::v1::*; +//! ``` + +#![unstable(feature = "alloc_prelude", issue = "58935")] + +pub mod v1; diff --git a/src/liballoc/prelude/v1.rs b/src/liballoc/prelude/v1.rs new file mode 100644 index 00000000000..b6b01395ad6 --- /dev/null +++ b/src/liballoc/prelude/v1.rs @@ -0,0 +1,11 @@ +//! The first version of the prelude of `alloc` crate. +//! +//! See the [module-level documentation](../index.html) for more. + +#![unstable(feature = "alloc_prelude", issue = "58935")] + +#[unstable(feature = "alloc_prelude", issue = "58935")] pub use crate::borrow::ToOwned; +#[unstable(feature = "alloc_prelude", issue = "58935")] pub use crate::boxed::Box; +#[unstable(feature = "alloc_prelude", issue = "58935")] pub use crate::slice::SliceConcatExt; +#[unstable(feature = "alloc_prelude", issue = "58935")] pub use crate::string::{String, ToString}; +#[unstable(feature = "alloc_prelude", issue = "58935")] pub use crate::vec::Vec; |
