message: Fix sysroot for rustdoc
diff: @@ -841,11 +841,13 @@ fn phase_cargo_runner(binary: &Path, binary_args: env::Args) {
  cmd.arg(arg);
  }
  }
  + if env::var_os("MIRI_CALLED_FROM_RUSTDOC").is_none() {
  // Set sysroot.
  let sysroot =
  env::var_os("MIRI_SYSROOT").expect("the wrapper should have set MIRI_SYSROOT");
  cmd.arg("--sysroot");
  cmd.arg(sysroot);
  + }
  // Respect `MIRIFLAGS`.
  if let Ok(a) = env::var("MIRIFLAGS") {
  // This code is taken from `RUSTFLAGS` handling in cargo.
  @@ -928,6 +930,12 @@ fn phase_cargo_rustdoc(fst_arg: &str, mut args: env::Args) {
  // which are disabled by default. We first need to enable them explicitly:
  cmd.arg("-Z").arg("unstable-options");
  + // Use our custom sysroot.
  + let sysroot =
  + env::var_os("MIRI_SYSROOT").expect("the wrapper should have set MIRI_SYSROOT");
  + cmd.arg("--sysroot");
  + cmd.arg(sysroot);
  +
  let cargo_miri_path = std::env::current_exe().expect("current executable path invalid");
  cmd.arg("--test-builder").arg(&cargo_miri_path); // invoked by forwarding most arguments
  cmd.arg("--runtool").arg(&cargo_miri_path); // invoked with just a single path argument
  