Skip to content

Commit da61b24

Browse files
committed
Run xargo check instead of xargo build to build libstd
This gives us crate metadata without running any codegen
1 parent 07fa6f8 commit da61b24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/cargo-miri.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,12 @@ path = "lib.rs"
318318
let target = get_arg_flag_value("--target");
319319
let print_sysroot = !ask_user && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path
320320
let mut command = xargo();
321-
command.arg("build").arg("-q");
321+
// This may seen somewhat suprising - we are 'building' libstd
322+
// by running (the equivalent of) `cargo check`. It turns out
323+
// that `cargo check` has exactly the behavior that we want:
324+
// it emits crate metadata (including MIR) without running any
325+
// codegen.
326+
command.arg("check").arg("-q");
322327
command.current_dir(&dir);
323328
command.env("RUSTFLAGS", miri::miri_default_args().join(" "));
324329
command.env("XARGO_HOME", dir.to_str().unwrap());

0 commit comments

Comments
 (0)