Skip to content

Commit

Permalink
Rollup merge of rust-lang#58933 - SimonSapin:alloc-prelude-v1, r=Amanieu
Browse files Browse the repository at this point in the history
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std

This was one of the unresolved questions of rust-lang/rfcs#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 rust-lang#58175.

Also rename the feature gate and point to a dedicated tracking issue: rust-lang#58935
  • Loading branch information
kennytm authored Mar 15, 2019
2 parents b3c597f + 5d1022a commit 237d769
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/liballoc/prelude.rs

This file was deleted.

16 changes: 16 additions & 0 deletions src/liballoc/prelude/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
11 changes: 11 additions & 0 deletions src/liballoc/prelude/v1.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 237d769

Please sign in to comment.