Skip to content

Commit a4ce33c

Browse files
committed
Auto merge of rust-lang#126728 - onur-ozkan:stage1-rustdoc, r=Kobzol
rustdoc: use current stage if download-rustc enabled When using download-rustc, using stage 1 rustdoc results in the wrong librustc_driver being used. ```sh $ ./build/host/stage1/bin/rustdoc --version ./build/host/stage1/bin/rustdoc: error while loading shared libraries: librustc_driver-7ff02ed05016d515.so: cannot open shared object file: No such file or directory ``` This change fixes that by not cutting the stage if download-rustc is enabled.
2 parents 127fa22 + 08fa5f0 commit a4ce33c

File tree

1 file changed

+11
-12
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+11
-12
lines changed

Diff for: src/bootstrap/src/core/build_steps/tool.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -551,24 +551,23 @@ impl Step for Rustdoc {
551551
return builder.initial_rustc.with_file_name(exe("rustdoc", target_compiler.host));
552552
}
553553
let target = target_compiler.host;
554-
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
555-
// we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
556-
// compilers, which isn't what we want. Rustdoc should be linked in the same way as the
557-
// rustc compiler it's paired with, so it must be built with the previous stage compiler.
558-
let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
554+
555+
let build_compiler = if builder.download_rustc() && target_compiler.stage == 1 {
556+
// We already have the stage 1 compiler, we don't need to cut the stage.
557+
builder.compiler(target_compiler.stage, builder.config.build)
558+
} else {
559+
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
560+
// we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
561+
// compilers, which isn't what we want. Rustdoc should be linked in the same way as the
562+
// rustc compiler it's paired with, so it must be built with the previous stage compiler.
563+
builder.compiler(target_compiler.stage - 1, builder.config.build)
564+
};
559565

560566
// When using `download-rustc` and a stage0 build_compiler, copying rustc doesn't actually
561567
// build stage0 libstd (because the libstd in sysroot has the wrong ABI). Explicitly build
562568
// it.
563569
builder.ensure(compile::Std::new(build_compiler, target_compiler.host));
564570
builder.ensure(compile::Rustc::new(build_compiler, target_compiler.host));
565-
// NOTE: this implies that `download-rustc` is pretty useless when compiling with the stage0
566-
// compiler, since you do just as much work.
567-
if !builder.config.dry_run() && builder.download_rustc() && build_compiler.stage == 0 {
568-
println!(
569-
"WARNING: `download-rustc` does nothing when building stage1 tools; consider using `--stage 2` instead"
570-
);
571-
}
572571

573572
// The presence of `target_compiler` ensures that the necessary libraries (codegen backends,
574573
// compiler libraries, ...) are built. Rustdoc does not require the presence of any

0 commit comments

Comments
 (0)