Skip to content

Commit ba15da4

Browse files
committed
Auto merge of rust-lang#2212 - RalfJung:cargo-miri, r=RalfJung
update and move cargo-miri operational description
2 parents 4d72580 + cca3dea commit ba15da4

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

cargo-miri/bin.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,19 @@ fn main() {
10631063
// Skip binary name.
10641064
args.next().unwrap();
10651065

1066+
// Dispatch to `cargo-miri` phase. There are four phases:
1067+
// - When we are called via `cargo miri`, we run as the frontend and invoke the underlying
1068+
// cargo. We set RUSTDOC, RUSTC_WRAPPER and CARGO_TARGET_RUNNER to ourselves.
1069+
// - When we are executed due to RUSTDOC, we run rustdoc and set both `--test-builder` and
1070+
// `--runtool` to ourselves.
1071+
// - When we are executed due to RUSTC_WRAPPER (or as the rustdoc test builder), we build crates
1072+
// or store the flags of binary crates for later interpretation.
1073+
// - When we are executed due to CARGO_TARGET_RUNNER (or as the rustdoc runtool), we start
1074+
// interpretation based on the flags that were stored earlier.
1075+
//
1076+
// Additionally, we also set ourselves as RUSTC when calling xargo to build the sysroot, which
1077+
// has to be treated slightly differently than when we build regular crates.
1078+
10661079
// Dispatch running as part of sysroot compilation.
10671080
if env::var_os("MIRI_CALLED_FROM_XARGO").is_some() {
10681081
phase_rustc(args, RustcPhase::Setup);
@@ -1094,14 +1107,6 @@ fn main() {
10941107
return;
10951108
}
10961109

1097-
// Dispatch to `cargo-miri` phase. There are three phases:
1098-
// - When we are called via `cargo miri`, we run as the frontend and invoke the underlying
1099-
// cargo. We set RUSTC_WRAPPER and CARGO_TARGET_RUNNER to ourselves.
1100-
// - When we are executed due to RUSTC_WRAPPER, we build crates or store the flags of
1101-
// binary crates for later interpretation.
1102-
// - When we are executed due to CARGO_TARGET_RUNNER, we start interpretation based on the
1103-
// flags that were stored earlier.
1104-
// On top of that, we are also called as RUSTDOC, but that is just a stub currently.
11051110
match args.next().as_deref() {
11061111
Some("miri") => phase_cargo_miri(args),
11071112
Some("rustc") => phase_rustc(args, RustcPhase::Build),

0 commit comments

Comments
 (0)