From 1b7954c4f191f261dd9dbc4bc0814d380397084a Mon Sep 17 00:00:00 2001 From: Jynn Nelson Date: Wed, 3 Dec 2025 15:39:47 -0500 Subject: [PATCH] Allow running `x test reference` locally Previously this would break for me with: ``` Testing stage2 mdbook src/doc/reference (aarch64-apple-darwin) error: manifest path `mdbook-spec/Cargo.toml` does not exist ``` but then would say "build completed successfully" ... I guess that's related to toolstate somehow. I have no idea how this ever passed in CI. --- Cargo.toml | 1 + src/bootstrap/src/core/build_steps/test.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 67c7a9d67edc8..fe444de6b2782 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ exclude = [ "compiler/rustc_codegen_gcc", "src/bootstrap", "tests/rustdoc-gui", + "src/doc/reference/mdbook-spec", # HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`. "obj", ] diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index d888e63275cda..7f7c0100947b7 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2496,7 +2496,9 @@ impl BookTest { let path = builder.src.join(&self.path); // Books often have feature-gated example text. rustbook_cmd.env("RUSTC_BOOTSTRAP", "1"); - rustbook_cmd.env("PATH", new_path).arg("test").arg(path); + rustbook_cmd.env("PATH", new_path).arg("test").arg(&path); + // The reference has a nested `cargo run` in `preprocessor.spec` which uses relative paths. + rustbook_cmd.current_dir(&path); // Books may also need to build dependencies. For example, `TheBook` has // code samples which use the `trpl` crate. For the `rustdoc` invocation