From 1ab9fe5d44860050232438967bbbf9bdc35dbde1 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 17 Feb 2021 13:33:47 +0100 Subject: [PATCH] Add {core,std}::prelude::{rust_2015,rust_2018,rust_2021}. rust_2015 and rust_2018 are just re-exports of v1. rust_2021 is a module that for now just re-exports everything from v1, such that we can add more things later. --- library/core/src/prelude/mod.rs | 36 +++++++++++++++++++++++++++++++++ library/core/src/prelude/v1.rs | 6 ++---- library/std/src/lib.rs | 1 + library/std/src/prelude/mod.rs | 34 +++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) diff --git a/library/core/src/prelude/mod.rs b/library/core/src/prelude/mod.rs index 51f4acf0685..1cb65eabb9a 100644 --- a/library/core/src/prelude/mod.rs +++ b/library/core/src/prelude/mod.rs @@ -1,5 +1,41 @@ //! The libcore prelude +//! +//! This module is intended for users of libcore which do not link to libstd as +//! well. This module is imported by default when `#![no_std]` is used in the +//! same manner as the standard library's prelude. #![stable(feature = "core_prelude", since = "1.4.0")] pub mod v1; + +/// The 2015 version of the core prelude. +/// +/// See the [module-level documentation](../index.html) for more. +#[unstable(feature = "prelude_2015", issue = "none")] +pub mod rust_2015 { + #[unstable(feature = "prelude_2015", issue = "none")] + #[doc(no_inline)] + pub use super::v1::*; +} + +/// The 2018 version of the core prelude. +/// +/// See the [module-level documentation](../index.html) for more. +#[unstable(feature = "prelude_2018", issue = "none")] +pub mod rust_2018 { + #[unstable(feature = "prelude_2018", issue = "none")] + #[doc(no_inline)] + pub use super::v1::*; +} + +/// The 2021 version of the core prelude. +/// +/// See the [module-level documentation](../index.html) for more. +#[unstable(feature = "prelude_2021", issue = "none")] +pub mod rust_2021 { + #[unstable(feature = "prelude_2021", issue = "none")] + #[doc(no_inline)] + pub use super::v1::*; + + // FIXME: Add more things. +} diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index a1fbd8dec75..993281fe882 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -1,8 +1,6 @@ -//! The core prelude +//! The first version of the core prelude. //! -//! This module is intended for users of libcore which do not link to libstd as -//! well. This module is imported by default when `#![no_std]` is used in the -//! same manner as the standard library's prelude. +//! See the [module-level documentation](../index.html) for more. #![stable(feature = "core_prelude", since = "1.4.0")] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 588bffb57c9..de816bdfef0 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -299,6 +299,7 @@ #![feature(panic_internals)] #![feature(panic_unwind)] #![feature(pin_static_ref)] +#![feature(prelude_2021)] #![feature(prelude_import)] #![feature(ptr_internals)] #![feature(raw)] diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs index eb2095b8196..bb45aed90e7 100644 --- a/library/std/src/prelude/mod.rs +++ b/library/std/src/prelude/mod.rs @@ -84,3 +84,37 @@ #![stable(feature = "rust1", since = "1.0.0")] pub mod v1; + +/// The 2015 version of the prelude of The Rust Standard Library. +/// +/// See the [module-level documentation](../index.html) for more. +#[unstable(feature = "prelude_2015", issue = "none")] +pub mod rust_2015 { + #[unstable(feature = "prelude_2015", issue = "none")] + #[doc(no_inline)] + pub use super::v1::*; +} + +/// The 2018 version of the prelude of The Rust Standard Library. +/// +/// See the [module-level documentation](../index.html) for more. +#[unstable(feature = "prelude_2018", issue = "none")] +pub mod rust_2018 { + #[unstable(feature = "prelude_2018", issue = "none")] + #[doc(no_inline)] + pub use super::v1::*; +} + +/// The 2021 version of the prelude of The Rust Standard Library. +/// +/// See the [module-level documentation](../index.html) for more. +#[unstable(feature = "prelude_2021", issue = "none")] +pub mod rust_2021 { + #[unstable(feature = "prelude_2021", issue = "none")] + #[doc(no_inline)] + pub use super::v1::*; + + #[unstable(feature = "prelude_2021", issue = "none")] + #[doc(no_inline)] + pub use core::prelude::rust_2021::*; +}