From 1a86482c5727a40b348dae02b9ef136c5cfcb3f5 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sun, 26 Nov 2023 17:59:20 +0300 Subject: [PATCH 1/4] skip {tidy,compiletest,rustdoc-gui} based tests for `DocTests::Only` As use of `--doc` with `x test` is intended for running doc-tests only, executing compiletest, tidy or rustdoc-gui based tests considered as an incorrect behavior from bootstrap. This change fixes that. Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/test.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index ec859d30c82..cf52270efac 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -999,6 +999,7 @@ impl Step for RustdocGUI { let run = run.suite_path("tests/rustdoc-gui"); run.lazy_default_condition(Box::new(move || { builder.config.nodejs.is_some() + && builder.doc_tests != DocTests::Only && builder .config .npm @@ -1158,7 +1159,8 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to } fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src/tools/tidy") + let default = run.builder.doc_tests != DocTests::Only; + run.path("src/tools/tidy").default_condition(default) } fn make_run(run: RunConfig<'_>) { @@ -1560,6 +1562,10 @@ impl Step for Compiletest { /// compiletest `mode` and `suite` arguments. For example `mode` can be /// "run-pass" or `suite` can be something like `debuginfo`. fn run(self, builder: &Builder<'_>) { + if builder.doc_tests == DocTests::Only { + return; + } + if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() { eprintln!("\ ERROR: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail @@ -2323,6 +2329,8 @@ impl Step for CrateLibrustc { } fn run(self, builder: &Builder<'_>) { + builder.ensure(compile::Std::new(self.compiler, self.target)); + builder.ensure(Crate { compiler: self.compiler, target: self.target, From 4d9344d26ebe8ac6ede26ca054a57334be4299ad Mon Sep 17 00:00:00 2001 From: clubby789 Date: Sun, 26 Nov 2023 16:22:43 +0000 Subject: [PATCH 2/4] Fix Rustdoc search docs link --- src/librustdoc/html/static/js/main.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 615fb08c76f..afc735e3990 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1328,8 +1328,7 @@ function preLoadCss(cssUrl) { const infos = [ `For a full list of all search features, take a look here.`, +href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.html">here.`, "Prefix searches with a type followed by a colon (e.g., fn:) to \ restrict the search to a given item kind.", "Accepted kinds are: fn, mod, struct, \ From f1eee2843fd3e62c71d993f732082b28cb5b22a0 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 27 Nov 2023 09:37:01 +1100 Subject: [PATCH 3/4] Put backticks around some attributes in doc comments. Without backticks they cause some "unresolved link to `foo`" warnings. --- compiler/rustc_index_macros/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_index_macros/src/lib.rs b/compiler/rustc_index_macros/src/lib.rs index 13500949a22..ac374a41eb6 100644 --- a/compiler/rustc_index_macros/src/lib.rs +++ b/compiler/rustc_index_macros/src/lib.rs @@ -23,14 +23,14 @@ mod newtype; /// The impls provided by default are Clone, Copy, PartialEq, Eq, and Hash. /// /// Accepted attributes for customization: -/// - #[derive(HashStable_Generic)]/#[derive(HashStable)]: derives +/// - `#[derive(HashStable_Generic)]`/`#[derive(HashStable)]`: derives /// `HashStable`, as normal. -/// - #[encodable]: derives `Encodable`/`Decodable`. -/// - #[orderable]: derives `PartialOrd`/`Ord`, plus step-related methods. -/// - #[debug_format = "Foo({})"]: derives `Debug` with particular output. -/// - #[max = 0xFFFF_FFFD]: specifies the max value, which allows niche +/// - `#[encodable]`: derives `Encodable`/`Decodable`. +/// - `#[orderable]`: derives `PartialOrd`/`Ord`, plus step-related methods. +/// - `#[debug_format = "Foo({})"]`: derives `Debug` with particular output. +/// - `#[max = 0xFFFF_FFFD]`: specifies the max value, which allows niche /// optimizations. The default max value is 0xFFFF_FF00. -/// - #[gate_rustc_only]: makes parts of the generated code nightly-only. +/// - `#[gate_rustc_only]`: makes parts of the generated code nightly-only. #[proc_macro] #[cfg_attr( feature = "nightly", From 566df2722a388cced3725e7ae1fc6cfb4e044335 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 27 Nov 2023 09:38:58 +1100 Subject: [PATCH 4/4] Fix some backticks in comments. --- compiler/rustc_ast_pretty/src/pprust/state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index a3bf47328ea..86aba343bc4 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -151,7 +151,7 @@ pub fn print_crate<'a>( /// Note: some old proc macros parse pretty-printed output, so changes here can /// break old code. For example: /// - #63896: `#[allow(unused,` must be printed rather than `#[allow(unused ,` -/// - #73345: `#[allow(unused)] must be printed rather than `# [allow(unused)] +/// - #73345: `#[allow(unused)]` must be printed rather than `# [allow(unused)]` /// fn space_between(tt1: &TokenTree, tt2: &TokenTree) -> bool { use token::*;