Auto merge of #99599 - RalfJung:miri-stage-0, r=RalfJung

miri: make --stage 0 testing work

This needs https://github.com/rust-lang/miri/pull/2415 or it'll break Miri entirely.

also fixes https://github.com/rust-lang/rust/issues/99589
This commit is contained in:
bors 2022-07-23 05:28:35 +00:00
commit 7d0a55bcdc
2 changed files with 9 additions and 1 deletions

View File

@ -475,6 +475,9 @@ fn run(self, builder: &Builder<'_>) {
let stage = self.stage; let stage = self.stage;
let host = self.host; let host = self.host;
let compiler = builder.compiler(stage, host); let compiler = builder.compiler(stage, host);
// We need the stdlib for the *next* stage, as it was built with this compiler that also built Miri.
// Except if we are at stage 2, the bootstrap loop is complete and we can stick with our current stage.
let compiler_std = builder.compiler(if stage < 2 { stage + 1 } else { stage }, host);
let miri = let miri =
builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() }); builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() });
@ -483,6 +486,10 @@ fn run(self, builder: &Builder<'_>) {
target: self.host, target: self.host,
extra_features: Vec::new(), extra_features: Vec::new(),
}); });
// The stdlib we need might be at a different stage. And just asking for the
// sysroot does not seem to populate it, so we do that first.
builder.ensure(compile::Std::new(compiler_std, host));
let sysroot = builder.sysroot(compiler_std);
if let (Some(miri), Some(_cargo_miri)) = (miri, cargo_miri) { if let (Some(miri), Some(_cargo_miri)) = (miri, cargo_miri) {
let mut cargo = let mut cargo =
builder.cargo(compiler, Mode::ToolRustc, SourceType::Submodule, host, "install"); builder.cargo(compiler, Mode::ToolRustc, SourceType::Submodule, host, "install");
@ -562,6 +569,7 @@ fn run(self, builder: &Builder<'_>) {
// miri tests need to know about the stage sysroot // miri tests need to know about the stage sysroot
cargo.env("MIRI_SYSROOT", miri_sysroot); cargo.env("MIRI_SYSROOT", miri_sysroot);
cargo.env("MIRI_HOST_SYSROOT", sysroot);
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler)); cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
cargo.env("MIRI", miri); cargo.env("MIRI", miri);

@ -1 +1 @@
Subproject commit dac1676eb3bea10e94404bc5b40412742ea5e8d9 Subproject commit 963f08b702caf7a06eed564312933ec50dd07f54