about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-25 14:09:33 +0000
committerbors <bors@rust-lang.org>2024-03-25 14:09:33 +0000
commitcb7c63606e53715f94f3ba04d38e50772e4cd23d (patch)
tree5e5776710c08f47ba88ff65ea813507961cf8f99
parentaf98101ed89dba94309c64f1fbf37c890d988f9f (diff)
parent8c219af8bf9c21d4c35b8106ab7fe0d9170c533d (diff)
Auto merge of #123030 - GuillaumeGomez:rustdoc-sysroot-out-of-arg-file, r=notriddle
Move `--sysroot` argument out of the argument file to fix miri issue

Fixes https://github.com/rust-lang/miri/issues/3404.

For now, miri needs this argument to be moved out of the arg file so they can update it if needed.

cc `@RalfJung`

r? `@notriddle`
-rw-r--r--src/librustdoc/doctest.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 211921715b0..22a3cf4d44d 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -67,9 +67,6 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) ->
         }
     }
 
-    if let Some(sysroot) = &options.maybe_sysroot {
-        content.push(format!("--sysroot={}", sysroot.display()));
-    }
     for lib_str in &options.lib_strs {
         content.push(format!("-L{lib_str}"));
     }
@@ -411,6 +408,10 @@ fn run_test(
 
     compiler.arg(&format!("@{}", rustdoc_options.arg_file.display()));
 
+    if let Some(sysroot) = &rustdoc_options.maybe_sysroot {
+        compiler.arg(format!("--sysroot={}", sysroot.display()));
+    }
+
     compiler.arg("--edition").arg(&edition.to_string());
     compiler.env("UNSTABLE_RUSTDOC_TEST_PATH", path);
     compiler.env("UNSTABLE_RUSTDOC_TEST_LINE", format!("{}", line as isize - line_offset as isize));
@@ -950,6 +951,7 @@ pub(crate) struct IndividualTestOptions {
     runtool_args: Vec<String>,
     target: TargetTriple,
     test_id: String,
+    maybe_sysroot: Option<PathBuf>,
 }
 
 impl IndividualTestOptions {
@@ -982,6 +984,7 @@ impl IndividualTestOptions {
             runtool_args: options.runtool_args.clone(),
             target: options.target.clone(),
             test_id,
+            maybe_sysroot: options.maybe_sysroot.clone(),
         }
     }
 }