Skip to content

Commit 891ceab

Browse files
authored
Rollup merge of rust-lang#86294 - m-ou-se:edition-prelude-modules, r=joshtriplett
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: rust-lang#85684 FCP on the RFC that included this finished here: rust-lang/rfcs#3114 (comment)
2 parents 178d17f + 65c1d35 commit 891ceab

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

library/core/src/prelude/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@ pub mod v1;
1111
/// The 2015 version of the core prelude.
1212
///
1313
/// See the [module-level documentation](self) for more.
14-
#[unstable(feature = "prelude_2015", issue = "85684")]
14+
#[stable(feature = "prelude_2015", since = "1.55.0")]
1515
pub mod rust_2015 {
16-
#[unstable(feature = "prelude_2015", issue = "85684")]
16+
#[stable(feature = "prelude_2015", since = "1.55.0")]
1717
#[doc(no_inline)]
1818
pub use super::v1::*;
1919
}
2020

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

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

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

44-
#[unstable(feature = "prelude_2021", issue = "85684")]
44+
#[stable(feature = "prelude_2021", since = "1.55.0")]
4545
#[doc(no_inline)]
4646
pub use crate::convert::{TryFrom, TryInto};
4747
}

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@
302302
#![feature(panic_internals)]
303303
#![feature(panic_unwind)]
304304
#![feature(pin_static_ref)]
305-
#![feature(prelude_2021)]
306305
#![feature(prelude_import)]
307306
#![feature(ptr_internals)]
308307
#![feature(raw)]

library/std/src/prelude/mod.rs

+23-9
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
//!
2626
//! # Prelude contents
2727
//!
28-
//! The current version of the prelude (version 1) lives in
29-
//! [`std::prelude::v1`], and re-exports the following:
28+
//! The first version of the prelude is used in Rust 2015 and Rust 2018,
29+
//! and lives in [`std::prelude::v1`].
30+
//! [`std::prelude::rust_2015`] and [`std::prelude::rust_2018`] re-export this prelude.
31+
//! It re-exports the following:
3032
//!
3133
//! * <code>[std::marker]::{[Copy], [Send], [Sized], [Sync], [Unpin]}</code>,
3234
//! marker traits that indicate fundamental properties of types.
@@ -58,6 +60,12 @@
5860
//! * <code>[std::string]::{[String], [ToString]}</code>, heap-allocated strings.
5961
//! * <code>[std::vec]::[Vec]</code>, a growable, heap-allocated vector.
6062
//!
63+
//! The prelude used in Rust 2021, [`std::prelude::rust_2021`], includes all of the above,
64+
//! and in addition re-exports:
65+
//!
66+
//! * <code>[std::convert]::{[TryFrom], [TryInto]}</code>,
67+
//! * <code>[std::iter]::[FromIterator]</code>.
68+
//!
6169
//! [mem::drop]: crate::mem::drop
6270
//! [std::borrow]: crate::borrow
6371
//! [std::boxed]: crate::boxed
@@ -71,10 +79,16 @@
7179
//! [std::ops]: crate::ops
7280
//! [std::option]: crate::option
7381
//! [`std::prelude::v1`]: v1
82+
//! [`std::prelude::rust_2015`]: rust_2015
83+
//! [`std::prelude::rust_2018`]: rust_2018
84+
//! [`std::prelude::rust_2021`]: rust_2021
7485
//! [std::result]: crate::result
7586
//! [std::slice]: crate::slice
7687
//! [std::string]: crate::string
7788
//! [std::vec]: mod@crate::vec
89+
//! [TryFrom]: crate::convert::TryFrom
90+
//! [TryInto]: crate::convert::TryInto
91+
//! [FromIterator]: crate::iter::FromIterator
7892
//! [`to_owned`]: crate::borrow::ToOwned::to_owned
7993
//! [book-closures]: ../../book/ch13-01-closures.html
8094
//! [book-dtor]: ../../book/ch15-03-drop.html
@@ -88,33 +102,33 @@ pub mod v1;
88102
/// The 2015 version of the prelude of The Rust Standard Library.
89103
///
90104
/// See the [module-level documentation](self) for more.
91-
#[unstable(feature = "prelude_2015", issue = "85684")]
105+
#[stable(feature = "prelude_2015", since = "1.55.0")]
92106
pub mod rust_2015 {
93-
#[unstable(feature = "prelude_2015", issue = "85684")]
107+
#[stable(feature = "prelude_2015", since = "1.55.0")]
94108
#[doc(no_inline)]
95109
pub use super::v1::*;
96110
}
97111

98112
/// The 2018 version of the prelude of The Rust Standard Library.
99113
///
100114
/// See the [module-level documentation](self) for more.
101-
#[unstable(feature = "prelude_2018", issue = "85684")]
115+
#[stable(feature = "prelude_2018", since = "1.55.0")]
102116
pub mod rust_2018 {
103-
#[unstable(feature = "prelude_2018", issue = "85684")]
117+
#[stable(feature = "prelude_2018", since = "1.55.0")]
104118
#[doc(no_inline)]
105119
pub use super::v1::*;
106120
}
107121

108122
/// The 2021 version of the prelude of The Rust Standard Library.
109123
///
110124
/// See the [module-level documentation](self) for more.
111-
#[unstable(feature = "prelude_2021", issue = "85684")]
125+
#[stable(feature = "prelude_2021", since = "1.55.0")]
112126
pub mod rust_2021 {
113-
#[unstable(feature = "prelude_2021", issue = "85684")]
127+
#[stable(feature = "prelude_2021", since = "1.55.0")]
114128
#[doc(no_inline)]
115129
pub use super::v1::*;
116130

117-
#[unstable(feature = "prelude_2021", issue = "85684")]
131+
#[stable(feature = "prelude_2021", since = "1.55.0")]
118132
#[doc(no_inline)]
119133
pub use core::prelude::rust_2021::*;
120134
}

0 commit comments

Comments
 (0)