Skip to content

Commit

Permalink
Rollup merge of #86294 - m-ou-se:edition-prelude-modules, r=joshtriplett
Browse files Browse the repository at this point in the history
Stabilize {std, core}::prelude::rust_*.

This stabilizes the `{core, std}::prelude::{rust_2015, rust_2018, rust_2021}` modules.

The usage of these modules as the prelude in those editions was already stabilized. This just stabilizes the modules themselves, making it possible for a user to explicitly refer to them.

Tracking issue: #85684

FCP on the RFC that included this finished here: rust-lang/rfcs#3114 (comment)
  • Loading branch information
JohnTitor authored Jun 15, 2021
2 parents 178d17f + 65c1d35 commit 891ceab
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
16 changes: 8 additions & 8 deletions library/core/src/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@ pub mod v1;
/// The 2015 version of the core prelude.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2015", issue = "85684")]
#[stable(feature = "prelude_2015", since = "1.55.0")]
pub mod rust_2015 {
#[unstable(feature = "prelude_2015", issue = "85684")]
#[stable(feature = "prelude_2015", since = "1.55.0")]
#[doc(no_inline)]
pub use super::v1::*;
}

/// The 2018 version of the core prelude.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2018", issue = "85684")]
#[stable(feature = "prelude_2018", since = "1.55.0")]
pub mod rust_2018 {
#[unstable(feature = "prelude_2018", issue = "85684")]
#[stable(feature = "prelude_2018", since = "1.55.0")]
#[doc(no_inline)]
pub use super::v1::*;
}

/// The 2021 version of the core prelude.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
pub mod rust_2021 {
#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use super::v1::*;

#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use crate::iter::FromIterator;

#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use crate::convert::{TryFrom, TryInto};
}
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@
#![feature(panic_internals)]
#![feature(panic_unwind)]
#![feature(pin_static_ref)]
#![feature(prelude_2021)]
#![feature(prelude_import)]
#![feature(ptr_internals)]
#![feature(raw)]
Expand Down
32 changes: 23 additions & 9 deletions library/std/src/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
//!
//! # Prelude contents
//!
//! The current version of the prelude (version 1) lives in
//! [`std::prelude::v1`], and re-exports the following:
//! The first version of the prelude is used in Rust 2015 and Rust 2018,
//! and lives in [`std::prelude::v1`].
//! [`std::prelude::rust_2015`] and [`std::prelude::rust_2018`] re-export this prelude.
//! It re-exports the following:
//!
//! * <code>[std::marker]::{[Copy], [Send], [Sized], [Sync], [Unpin]}</code>,
//! marker traits that indicate fundamental properties of types.
Expand Down Expand Up @@ -58,6 +60,12 @@
//! * <code>[std::string]::{[String], [ToString]}</code>, heap-allocated strings.
//! * <code>[std::vec]::[Vec]</code>, a growable, heap-allocated vector.
//!
//! The prelude used in Rust 2021, [`std::prelude::rust_2021`], includes all of the above,
//! and in addition re-exports:
//!
//! * <code>[std::convert]::{[TryFrom], [TryInto]}</code>,
//! * <code>[std::iter]::[FromIterator]</code>.
//!
//! [mem::drop]: crate::mem::drop
//! [std::borrow]: crate::borrow
//! [std::boxed]: crate::boxed
Expand All @@ -71,10 +79,16 @@
//! [std::ops]: crate::ops
//! [std::option]: crate::option
//! [`std::prelude::v1`]: v1
//! [`std::prelude::rust_2015`]: rust_2015
//! [`std::prelude::rust_2018`]: rust_2018
//! [`std::prelude::rust_2021`]: rust_2021
//! [std::result]: crate::result
//! [std::slice]: crate::slice
//! [std::string]: crate::string
//! [std::vec]: mod@crate::vec
//! [TryFrom]: crate::convert::TryFrom
//! [TryInto]: crate::convert::TryInto
//! [FromIterator]: crate::iter::FromIterator
//! [`to_owned`]: crate::borrow::ToOwned::to_owned
//! [book-closures]: ../../book/ch13-01-closures.html
//! [book-dtor]: ../../book/ch15-03-drop.html
Expand All @@ -88,33 +102,33 @@ pub mod v1;
/// The 2015 version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2015", issue = "85684")]
#[stable(feature = "prelude_2015", since = "1.55.0")]
pub mod rust_2015 {
#[unstable(feature = "prelude_2015", issue = "85684")]
#[stable(feature = "prelude_2015", since = "1.55.0")]
#[doc(no_inline)]
pub use super::v1::*;
}

/// The 2018 version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2018", issue = "85684")]
#[stable(feature = "prelude_2018", since = "1.55.0")]
pub mod rust_2018 {
#[unstable(feature = "prelude_2018", issue = "85684")]
#[stable(feature = "prelude_2018", since = "1.55.0")]
#[doc(no_inline)]
pub use super::v1::*;
}

/// The 2021 version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
pub mod rust_2021 {
#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use super::v1::*;

#[unstable(feature = "prelude_2021", issue = "85684")]
#[stable(feature = "prelude_2021", since = "1.55.0")]
#[doc(no_inline)]
pub use core::prelude::rust_2021::*;
}

0 comments on commit 891ceab

Please sign in to comment.