Skip to content

Commit ced4156

Browse files
authored
Rollup merge of #95993 - jyn514:fix-stage0-doctests, r=Mark-Simulacrum
Fix `x test --doc --stage 0 library/std` I managed to break this in #95449. I am not quite sure why this is the correct fix, but it doesn't break `doc --stage 0` and is strictly closer to the previous behavior. Previously, rustdoc would error with strange issues because of the mismatched sysroot: ``` error[E0460]: found possibly newer version of crate `std` which `rustc_span` depends on --> /home/jnelson/rust-lang/rust/compiler/rustc_lint_defs/src/lib.rs:14:5 | 14 | use rustc_span::{sym, symbol::Ident, Span, Symbol}; | ^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? = note: the following crate versions were found: crate `std`: /home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ff9290e971253a38.rlib crate `std`: /home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ff9290e971253a38.so crate `rustc_span`: /home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-ed11dce30c1766f9.rlib ```
2 parents 33e7edc + 69de213 commit ced4156

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/bootstrap/bin/rustdoc.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ fn main() {
3131

3232
let mut cmd = Command::new(rustdoc);
3333

34-
if target.is_some() {
34+
// I am not actually sure why it's necessary to pass the sysroot for `--test`,
35+
// but `test --doc --stage 0` is broken without it :(
36+
if target.is_some() || args.iter().any(|x| x == "--test") {
3537
// The stage0 compiler has a special sysroot distinct from what we
3638
// actually downloaded, so we just always pass the `--sysroot` option,
3739
// unless one is already set.

0 commit comments

Comments
 (0)