]> git.lizzy.rs Git - rust.git/commitdiff
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std
authorSimon Sapin <simon.sapin@exyr.org>
Tue, 5 Mar 2019 08:58:47 +0000 (09:58 +0100)
committerSimon Sapin <simon.sapin@exyr.org>
Tue, 5 Mar 2019 09:02:38 +0000 (10:02 +0100)
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

src/liballoc/prelude.rs [deleted file]
src/liballoc/prelude/mod.rs [new file with mode: 0644]
src/liballoc/prelude/v1.rs [new file with mode: 0644]

diff --git a/src/liballoc/prelude.rs b/src/liballoc/prelude.rs
deleted file mode 100644 (file)
index 6767cf8..0000000
+++ /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 (file)
index 0000000..44a859d
--- /dev/null
@@ -0,0 +1,15 @@
+//! 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::v1::*;
+//! ```
+
+#![unstable(feature = "alloc", issue = "27783")]
+
+pub mod v1;
diff --git a/src/liballoc/prelude/v1.rs b/src/liballoc/prelude/v1.rs
new file mode 100644 (file)
index 0000000..2df330d
--- /dev/null
@@ -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", 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;