From 1ab9fe5d44860050232438967bbbf9bdc35dbde1 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 17 Feb 2021 13:33:47 +0100 Subject: [PATCH 1/5] 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 51f4acf068580..1cb65eabb9a62 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 a1fbd8dec7505..993281fe88247 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 588bffb57c9c5..de816bdfef04e 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 eb2095b819657..bb45aed90e7f4 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::*; +} From d3b564c3d79fd33ea7da3b9b2ea046daacab4467 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 17 Feb 2021 13:34:58 +0100 Subject: [PATCH 2/5] Pick the injected prelude based on the edition. --- .../src/standard_library_imports.rs | 30 ++++++++++++------- compiler/rustc_span/src/symbol.rs | 3 ++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/standard_library_imports.rs b/compiler/rustc_builtin_macros/src/standard_library_imports.rs index 3a81d076dc52f..efda731330721 100644 --- a/compiler/rustc_builtin_macros/src/standard_library_imports.rs +++ b/compiler/rustc_builtin_macros/src/standard_library_imports.rs @@ -3,7 +3,7 @@ use rustc_ast::ptr::P; use rustc_expand::base::{ExtCtxt, ResolverExpand}; use rustc_expand::expand::ExpansionConfig; use rustc_session::Session; -use rustc_span::edition::Edition; +use rustc_span::edition::Edition::*; use rustc_span::hygiene::AstPass; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::DUMMY_SP; @@ -14,7 +14,7 @@ pub fn inject( sess: &Session, alt_std_name: Option, ) -> ast::Crate { - let rust_2018 = sess.parse_sess.edition >= Edition::Edition2018; + let edition = sess.parse_sess.edition; // the first name in this list is the crate name of the crate with the prelude let names: &[Symbol] = if sess.contains_name(&krate.attrs, sym::no_core) { @@ -43,7 +43,11 @@ pub fn inject( // .rev() to preserve ordering above in combination with insert(0, ...) for &name in names.iter().rev() { - let ident = if rust_2018 { Ident::new(name, span) } else { Ident::new(name, call_site) }; + let ident = if edition >= Edition2018 { + Ident::new(name, span) + } else { + Ident::new(name, call_site) + }; krate.items.insert( 0, cx.item( @@ -59,14 +63,18 @@ pub fn inject( // the one with the prelude. let name = names[0]; - let import_path = if rust_2018 { - [name, sym::prelude, sym::v1].iter().map(|symbol| Ident::new(*symbol, span)).collect() - } else { - [kw::PathRoot, name, sym::prelude, sym::v1] - .iter() - .map(|symbol| Ident::new(*symbol, span)) - .collect() - }; + let root = (edition == Edition2015).then(|| kw::PathRoot); + + let import_path = root + .iter() + .chain(&[name, sym::prelude]) + .chain(&[match edition { + Edition2015 => sym::rust_2015, + Edition2018 => sym::rust_2018, + Edition2021 => sym::rust_2021, + }]) + .map(|&symbol| Ident::new(symbol, span)) + .collect(); let use_item = cx.item( span, diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index b112402ffe371..7b85c964dfd2d 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -944,8 +944,11 @@ symbols! { rt, rtm_target_feature, rust, + rust_2015, rust_2015_preview, + rust_2018, rust_2018_preview, + rust_2021, rust_2021_preview, rust_begin_unwind, rust_eh_catch_typeinfo, From 218cf30c53bbc193d9d2143f91e7379aa01f0aab Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 17 Feb 2021 15:52:31 +0100 Subject: [PATCH 3/5] Update test output for edition preludes. --- src/test/ui/ast-json/ast-json-output.stdout | 2 +- .../extern-prelude-extern-crate-restricted-shadowing.stderr | 6 +++--- src/test/ui/issues/issue-27033.stderr | 6 +++--- src/test/ui/issues/issue-60662.stdout | 2 +- src/test/ui/proc-macro/meta-macro-hygiene.stdout | 2 +- src/test/ui/proc-macro/nonterminal-token-hygiene.stdout | 2 +- src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/ui/ast-json/ast-json-output.stdout b/src/test/ui/ast-json/ast-json-output.stdout index d26530efe3ecd..535f57bf6af85 100644 --- a/src/test/ui/ast-json/ast-json-output.stdout +++ b/src/test/ui/ast-json/ast-json-output.stdout @@ -1 +1 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"v1","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0},"proc_macros":[]} +{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0},"proc_macros":[]} diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index 016c48118b3ce..4cda07758527a 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -24,10 +24,10 @@ LL | extern crate std as Vec; LL | define_vec!(); | -------------- in this macro invocation note: `Vec` could also refer to the struct defined here - --> $SRC_DIR/std/src/prelude/v1.rs:LL:COL + --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | -LL | pub use crate::vec::Vec; - | ^^^^^^^^^^^^^^^ +LL | pub use super::v1::*; + | ^^^^^^^^^^^^ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index ad48fc23a386b..fa42611d0b32e 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -4,10 +4,10 @@ error[E0530]: match bindings cannot shadow unit variants LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant | - ::: $SRC_DIR/std/src/prelude/v1.rs:LL:COL + ::: $SRC_DIR/std/src/prelude/mod.rs:LL:COL | -LL | pub use crate::option::Option::{self, None, Some}; - | ---- the unit variant `None` is defined here +LL | pub use super::v1::*; + | ------------ the unit variant `None` is defined here error[E0530]: match bindings cannot shadow constants --> $DIR/issue-27033.rs:7:9 diff --git a/src/test/ui/issues/issue-60662.stdout b/src/test/ui/issues/issue-60662.stdout index cebe834824a61..14a49f20e6b22 100644 --- a/src/test/ui/issues/issue-60662.stdout +++ b/src/test/ui/issues/issue-60662.stdout @@ -3,7 +3,7 @@ #![feature(type_alias_impl_trait)] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; diff --git a/src/test/ui/proc-macro/meta-macro-hygiene.stdout b/src/test/ui/proc-macro/meta-macro-hygiene.stdout index a067b7b5411dd..aa51fc8240d63 100644 --- a/src/test/ui/proc-macro/meta-macro-hygiene.stdout +++ b/src/test/ui/proc-macro/meta-macro-hygiene.stdout @@ -15,7 +15,7 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro #![no_std /* 0#0 */] #[prelude_import /* 0#1 */] -use core /* 0#1 */::prelude /* 0#1 */::v1 /* 0#1 */::*; +use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*; #[macro_use /* 0#1 */] extern crate core /* 0#1 */; #[macro_use /* 0#1 */] diff --git a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout index 1623d67772639..ba3b3ee782784 100644 --- a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -35,7 +35,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ #![no_std /* 0#0 */] #[prelude_import /* 0#1 */] -use ::core /* 0#1 */::prelude /* 0#1 */::v1 /* 0#1 */::*; +use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*; #[macro_use /* 0#1 */] extern crate core /* 0#2 */; #[macro_use /* 0#1 */] diff --git a/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout b/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout index c88f50c6813ec..aeee43b01cc02 100644 --- a/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout +++ b/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout @@ -1,7 +1,7 @@ #![feature(prelude_import)] #![no_std] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; // build-pass (FIXME(62277): could be check-pass?) From d274d87e10af104051e1e71f56539b20350dbdda Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 17 Feb 2021 15:52:31 +0100 Subject: [PATCH 4/5] Update test/pretty output for edition preludes. --- src/test/pretty/asm.pp | 2 +- src/test/pretty/cast-lt.pp | 2 +- src/test/pretty/dollar-crate.pp | 2 +- src/test/pretty/expanded-and-path-remap-80832.pp | 2 +- src/test/pretty/issue-12590-c.pp | 2 +- src/test/pretty/issue-4264.pp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/pretty/asm.pp b/src/test/pretty/asm.pp index b3d188dd70881..c86d8a1197188 100644 --- a/src/test/pretty/asm.pp +++ b/src/test/pretty/asm.pp @@ -2,7 +2,7 @@ #![no_std] #![feature(asm)] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; diff --git a/src/test/pretty/cast-lt.pp b/src/test/pretty/cast-lt.pp index 47a7dac95b9c5..4f6a924909029 100644 --- a/src/test/pretty/cast-lt.pp +++ b/src/test/pretty/cast-lt.pp @@ -1,7 +1,7 @@ #![feature(prelude_import)] #![no_std] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; // pretty-compare-only diff --git a/src/test/pretty/dollar-crate.pp b/src/test/pretty/dollar-crate.pp index 131cd0a67c669..f4be3c1c63a84 100644 --- a/src/test/pretty/dollar-crate.pp +++ b/src/test/pretty/dollar-crate.pp @@ -1,7 +1,7 @@ #![feature(prelude_import)] #![no_std] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; // pretty-compare-only diff --git a/src/test/pretty/expanded-and-path-remap-80832.pp b/src/test/pretty/expanded-and-path-remap-80832.pp index 6dbc19e9d9c6c..1579ea41cfdf1 100644 --- a/src/test/pretty/expanded-and-path-remap-80832.pp +++ b/src/test/pretty/expanded-and-path-remap-80832.pp @@ -1,7 +1,7 @@ #![feature(prelude_import)] #![no_std] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; // Test for issue 80832 diff --git a/src/test/pretty/issue-12590-c.pp b/src/test/pretty/issue-12590-c.pp index 1761c0653ce86..dd0b8899b2d9d 100644 --- a/src/test/pretty/issue-12590-c.pp +++ b/src/test/pretty/issue-12590-c.pp @@ -1,7 +1,7 @@ #![feature(prelude_import)] #![no_std] #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; // pretty-compare-only diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index 7b0a00282fbb0..199aee05622be 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -1,5 +1,5 @@ #[prelude_import] -use ::std::prelude::v1::*; +use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; // pretty-compare-only From 76fd8d7e74a000be4d736c47b55c583d31c907d0 Mon Sep 17 00:00:00 2001 From: Mara Date: Thu, 25 Feb 2021 12:41:39 +0100 Subject: [PATCH 5/5] Use intra-doc links. Co-authored-by: Joshua Nelson --- library/core/src/prelude/mod.rs | 6 +++--- library/core/src/prelude/v1.rs | 2 +- library/std/src/prelude/mod.rs | 6 +++--- library/std/src/prelude/v1.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/core/src/prelude/mod.rs b/library/core/src/prelude/mod.rs index 1cb65eabb9a62..8f57db49496c3 100644 --- a/library/core/src/prelude/mod.rs +++ b/library/core/src/prelude/mod.rs @@ -10,7 +10,7 @@ pub mod v1; /// The 2015 version of the core prelude. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](self) for more. #[unstable(feature = "prelude_2015", issue = "none")] pub mod rust_2015 { #[unstable(feature = "prelude_2015", issue = "none")] @@ -20,7 +20,7 @@ pub mod rust_2015 { /// The 2018 version of the core prelude. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](self) for more. #[unstable(feature = "prelude_2018", issue = "none")] pub mod rust_2018 { #[unstable(feature = "prelude_2018", issue = "none")] @@ -30,7 +30,7 @@ pub mod rust_2018 { /// The 2021 version of the core prelude. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](self) for more. #[unstable(feature = "prelude_2021", issue = "none")] pub mod rust_2021 { #[unstable(feature = "prelude_2021", issue = "none")] diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index 993281fe88247..dbbd10cd9930d 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -1,6 +1,6 @@ //! The first version of the core prelude. //! -//! See the [module-level documentation](../index.html) for more. +//! See the [module-level documentation](super) for more. #![stable(feature = "core_prelude", since = "1.4.0")] diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs index bb45aed90e7f4..505b5f3013b35 100644 --- a/library/std/src/prelude/mod.rs +++ b/library/std/src/prelude/mod.rs @@ -87,7 +87,7 @@ pub mod v1; /// The 2015 version of the prelude of The Rust Standard Library. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](self) for more. #[unstable(feature = "prelude_2015", issue = "none")] pub mod rust_2015 { #[unstable(feature = "prelude_2015", issue = "none")] @@ -97,7 +97,7 @@ pub mod rust_2015 { /// The 2018 version of the prelude of The Rust Standard Library. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](self) for more. #[unstable(feature = "prelude_2018", issue = "none")] pub mod rust_2018 { #[unstable(feature = "prelude_2018", issue = "none")] @@ -107,7 +107,7 @@ pub mod rust_2018 { /// The 2021 version of the prelude of The Rust Standard Library. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](self) for more. #[unstable(feature = "prelude_2021", issue = "none")] pub mod rust_2021 { #[unstable(feature = "prelude_2021", issue = "none")] diff --git a/library/std/src/prelude/v1.rs b/library/std/src/prelude/v1.rs index ef9aec54a4ca2..15afe19f6416c 100644 --- a/library/std/src/prelude/v1.rs +++ b/library/std/src/prelude/v1.rs @@ -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")]