Skip to content

Commit 1ab9fe5

Browse files
committed
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.
1 parent 89d32eb commit 1ab9fe5

File tree

4 files changed

+73
-4
lines changed

4 files changed

+73
-4
lines changed

library/core/src/prelude/mod.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
//! The libcore prelude
2+
//!
3+
//! This module is intended for users of libcore which do not link to libstd as
4+
//! well. This module is imported by default when `#![no_std]` is used in the
5+
//! same manner as the standard library's prelude.
26
37
#![stable(feature = "core_prelude", since = "1.4.0")]
48

59
pub mod v1;
10+
11+
/// The 2015 version of the core prelude.
12+
///
13+
/// See the [module-level documentation](../index.html) for more.
14+
#[unstable(feature = "prelude_2015", issue = "none")]
15+
pub mod rust_2015 {
16+
#[unstable(feature = "prelude_2015", issue = "none")]
17+
#[doc(no_inline)]
18+
pub use super::v1::*;
19+
}
20+
21+
/// The 2018 version of the core prelude.
22+
///
23+
/// See the [module-level documentation](../index.html) for more.
24+
#[unstable(feature = "prelude_2018", issue = "none")]
25+
pub mod rust_2018 {
26+
#[unstable(feature = "prelude_2018", issue = "none")]
27+
#[doc(no_inline)]
28+
pub use super::v1::*;
29+
}
30+
31+
/// The 2021 version of the core prelude.
32+
///
33+
/// See the [module-level documentation](../index.html) for more.
34+
#[unstable(feature = "prelude_2021", issue = "none")]
35+
pub mod rust_2021 {
36+
#[unstable(feature = "prelude_2021", issue = "none")]
37+
#[doc(no_inline)]
38+
pub use super::v1::*;
39+
40+
// FIXME: Add more things.
41+
}

library/core/src/prelude/v1.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
//! The core prelude
1+
//! The first version of the core prelude.
22
//!
3-
//! This module is intended for users of libcore which do not link to libstd as
4-
//! well. This module is imported by default when `#![no_std]` is used in the
5-
//! same manner as the standard library's prelude.
3+
//! See the [module-level documentation](../index.html) for more.
64
75
#![stable(feature = "core_prelude", since = "1.4.0")]
86

library/std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@
299299
#![feature(panic_internals)]
300300
#![feature(panic_unwind)]
301301
#![feature(pin_static_ref)]
302+
#![feature(prelude_2021)]
302303
#![feature(prelude_import)]
303304
#![feature(ptr_internals)]
304305
#![feature(raw)]

library/std/src/prelude/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,37 @@
8484
#![stable(feature = "rust1", since = "1.0.0")]
8585

8686
pub mod v1;
87+
88+
/// The 2015 version of the prelude of The Rust Standard Library.
89+
///
90+
/// See the [module-level documentation](../index.html) for more.
91+
#[unstable(feature = "prelude_2015", issue = "none")]
92+
pub mod rust_2015 {
93+
#[unstable(feature = "prelude_2015", issue = "none")]
94+
#[doc(no_inline)]
95+
pub use super::v1::*;
96+
}
97+
98+
/// The 2018 version of the prelude of The Rust Standard Library.
99+
///
100+
/// See the [module-level documentation](../index.html) for more.
101+
#[unstable(feature = "prelude_2018", issue = "none")]
102+
pub mod rust_2018 {
103+
#[unstable(feature = "prelude_2018", issue = "none")]
104+
#[doc(no_inline)]
105+
pub use super::v1::*;
106+
}
107+
108+
/// The 2021 version of the prelude of The Rust Standard Library.
109+
///
110+
/// See the [module-level documentation](../index.html) for more.
111+
#[unstable(feature = "prelude_2021", issue = "none")]
112+
pub mod rust_2021 {
113+
#[unstable(feature = "prelude_2021", issue = "none")]
114+
#[doc(no_inline)]
115+
pub use super::v1::*;
116+
117+
#[unstable(feature = "prelude_2021", issue = "none")]
118+
#[doc(no_inline)]
119+
pub use core::prelude::rust_2021::*;
120+
}

0 commit comments

Comments
 (0)