Skip to content

Commit c21a76f

Browse files
authored
Rollup merge of #136886 - ehuss:remove-prelude-common, r=jhpratt
Remove the common prelude module This fixes the issues described in #136102. Primarily, this resolves some issues with how the documentation for the prelude is generated: - It avoids showing "unstable" for macros in the prelude that are actually stable. - Avoids duplication of some pages due to the previous lack of `doc(no_inline)`. - Makes the different edition preludes consistent, and sets a pattern that can be used by future editions. We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems. Closes #136102
2 parents 678ff2a + 8c24c0a commit c21a76f

File tree

5 files changed

+13
-25
lines changed

5 files changed

+13
-25
lines changed

library/core/src/prelude/mod.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,7 @@
99

1010
#![stable(feature = "core_prelude", since = "1.4.0")]
1111

12-
mod common;
13-
14-
/// The first version of the prelude of The Rust Standard Library.
15-
///
16-
/// See the [module-level documentation](self) for more.
17-
#[stable(feature = "rust1", since = "1.0.0")]
18-
pub mod v1 {
19-
#[stable(feature = "rust1", since = "1.0.0")]
20-
pub use super::common::*;
21-
}
12+
pub mod v1;
2213

2314
/// The 2015 version of the core prelude.
2415
///
@@ -64,7 +55,8 @@ pub mod rust_2021 {
6455
#[stable(feature = "prelude_2024", since = "1.85.0")]
6556
pub mod rust_2024 {
6657
#[stable(feature = "rust1", since = "1.0.0")]
67-
pub use super::common::*;
58+
#[doc(no_inline)]
59+
pub use super::v1::*;
6860

6961
#[stable(feature = "prelude_2021", since = "1.55.0")]
7062
#[doc(no_inline)]

library/core/src/prelude/common.rs library/core/src/prelude/v1.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
//! Items common to the prelude of all editions.
1+
//! The first version of the core prelude.
22
//!
33
//! See the [module-level documentation](super) for more.
44
5+
#![stable(feature = "core_prelude", since = "1.4.0")]
6+
57
// No formatting: this file is nothing but re-exports, and their order is worth preserving.
68
#![cfg_attr(rustfmt, rustfmt::skip)]
79

library/std/src/prelude/mod.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,7 @@
111111

112112
#![stable(feature = "rust1", since = "1.0.0")]
113113

114-
mod common;
115-
116-
/// The first version of the prelude of The Rust Standard Library.
117-
///
118-
/// See the [module-level documentation](self) for more.
119-
#[stable(feature = "rust1", since = "1.0.0")]
120-
pub mod v1 {
121-
#[stable(feature = "rust1", since = "1.0.0")]
122-
pub use super::common::*;
123-
}
114+
pub mod v1;
124115

125116
/// The 2015 version of the prelude of The Rust Standard Library.
126117
///
@@ -162,7 +153,8 @@ pub mod rust_2021 {
162153
#[stable(feature = "prelude_2024", since = "1.85.0")]
163154
pub mod rust_2024 {
164155
#[stable(feature = "rust1", since = "1.0.0")]
165-
pub use super::common::*;
156+
#[doc(no_inline)]
157+
pub use super::v1::*;
166158

167159
#[stable(feature = "prelude_2024", since = "1.85.0")]
168160
#[doc(no_inline)]

library/std/src/prelude/common.rs library/std/src/prelude/v1.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
//! Items common to the prelude of all editions.
1+
//! The first version of the prelude of The Rust Standard Library.
22
//!
33
//! See the [module-level documentation](super) for more.
44
5+
#![stable(feature = "rust1", since = "1.0.0")]
6+
57
// No formatting: this file is nothing but re-exports, and their order is worth preserving.
68
#![cfg_attr(rustfmt, rustfmt::skip)]
79

tests/rustdoc-js-std/vec-new.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const EXPECTED = [
99
{
1010
'query': 'prelude::vec',
1111
'others': [
12-
{ 'path': 'std::prelude::rust_2024', 'name': 'Vec' },
12+
{ 'path': 'std::prelude::v1', 'name': 'Vec' },
1313
],
1414
},
1515
{

0 commit comments

Comments
 (0)