mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
set miri sysroots inside Cargo::new
This commit is contained in:
@@ -595,7 +595,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
// This is for the tests so everything is done with the target compiler.
|
||||
let miri_sysroot = Miri::build_miri_sysroot(builder, target_compiler, target);
|
||||
builder.ensure(compile::Std::new(target_compiler, host));
|
||||
let sysroot = builder.sysroot(target_compiler);
|
||||
let host_sysroot = builder.sysroot(target_compiler);
|
||||
|
||||
// # Run `cargo test`.
|
||||
// This is with the Miri crate, so it uses the host compiler.
|
||||
@@ -618,7 +618,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
|
||||
// miri tests need to know about the stage sysroot
|
||||
cargo.env("MIRI_SYSROOT", &miri_sysroot);
|
||||
cargo.env("MIRI_HOST_SYSROOT", &sysroot);
|
||||
cargo.env("MIRI_HOST_SYSROOT", &host_sysroot);
|
||||
cargo.env("MIRI", &miri);
|
||||
|
||||
// Set the target.
|
||||
@@ -681,10 +681,6 @@ fn run(self, builder: &Builder<'_>) {
|
||||
}
|
||||
}
|
||||
|
||||
// Tell `cargo miri` where to find the sysroots.
|
||||
cargo.env("MIRI_SYSROOT", &miri_sysroot);
|
||||
cargo.env("MIRI_HOST_SYSROOT", sysroot);
|
||||
|
||||
// Finally, pass test-args and run everything.
|
||||
cargo.arg("--").args(builder.config.test_args());
|
||||
let mut cargo = Command::from(cargo);
|
||||
|
||||
@@ -1235,6 +1235,7 @@ pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> Command {
|
||||
assert!(run_compiler.stage > 0, "miri can not be invoked at stage 0");
|
||||
let build_compiler = self.compiler(run_compiler.stage - 1, self.build.build);
|
||||
|
||||
// Prepare the tools
|
||||
let miri = self.ensure(tool::Miri {
|
||||
compiler: build_compiler,
|
||||
target: self.build.build,
|
||||
@@ -1245,7 +1246,7 @@ pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> Command {
|
||||
target: self.build.build,
|
||||
extra_features: Vec::new(),
|
||||
});
|
||||
// Invoke cargo-miri, make sure we can find miri and cargo.
|
||||
// Invoke cargo-miri, make sure it can find miri and cargo.
|
||||
let mut cmd = Command::new(cargo_miri);
|
||||
cmd.env("MIRI", &miri);
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
@@ -1711,6 +1712,15 @@ fn cargo(
|
||||
cargo.env("RUSTC_WRAPPER_REAL", existing_wrapper);
|
||||
}
|
||||
|
||||
// If this is for `miri-test`, prepare the sysroots.
|
||||
if cmd == "miri-test" {
|
||||
self.ensure(compile::Std::new(compiler, compiler.host));
|
||||
let host_sysroot = self.sysroot(compiler);
|
||||
let miri_sysroot = test::Miri::build_miri_sysroot(self, compiler, target);
|
||||
cargo.env("MIRI_SYSROOT", &miri_sysroot);
|
||||
cargo.env("MIRI_HOST_SYSROOT", &host_sysroot);
|
||||
}
|
||||
|
||||
cargo.env(profile_var("STRIP"), self.config.rust_strip.to_string());
|
||||
|
||||
if let Some(stack_protector) = &self.config.rust_stack_protector {
|
||||
|
||||
Reference in New Issue
Block a user