Rollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakis
Edition-specific preludes This changes `{std,core}::prelude` to export edition-specific preludes under `rust_2015`, `rust_2018` and `rust_2021`. (As suggested in https://github.com/rust-lang/rust/issues/51418#issuecomment-395630382.) For now they all just re-export `v1::*`, but this allows us to add things to the 2021edition prelude soon. This also changes the compiler to make the automatically injected prelude import dependent on the selected edition. cc `@rust-lang/libs` `@djc`
This commit is contained in:
commit
759204ffc4
20 changed files with 113 additions and 33 deletions
|
@ -302,6 +302,7 @@
|
|||
#![feature(panic_internals)]
|
||||
#![feature(panic_unwind)]
|
||||
#![feature(pin_static_ref)]
|
||||
#![feature(prelude_2021)]
|
||||
#![feature(prelude_import)]
|
||||
#![feature(ptr_internals)]
|
||||
#![feature(raw)]
|
||||
|
|
|
@ -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](self) 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](self) 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](self) 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::*;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! The first version of the prelude of The Rust Standard Library.
|
||||
//!
|
||||
//! See the [module-level documentation](../index.html) for more.
|
||||
//! See the [module-level documentation](super) for more.
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue