Skip to content

Commit cb7c636

Browse files
committed
Auto merge of rust-lang#123030 - GuillaumeGomez:rustdoc-sysroot-out-of-arg-file, r=notriddle
Move `--sysroot` argument out of the argument file to fix miri issue Fixes rust-lang/miri#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`
2 parents af98101 + 8c219af commit cb7c636

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustdoc/doctest.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) ->
6767
}
6868
}
6969

70-
if let Some(sysroot) = &options.maybe_sysroot {
71-
content.push(format!("--sysroot={}", sysroot.display()));
72-
}
7370
for lib_str in &options.lib_strs {
7471
content.push(format!("-L{lib_str}"));
7572
}
@@ -411,6 +408,10 @@ fn run_test(
411408

412409
compiler.arg(&format!("@{}", rustdoc_options.arg_file.display()));
413410

411+
if let Some(sysroot) = &rustdoc_options.maybe_sysroot {
412+
compiler.arg(format!("--sysroot={}", sysroot.display()));
413+
}
414+
414415
compiler.arg("--edition").arg(&edition.to_string());
415416
compiler.env("UNSTABLE_RUSTDOC_TEST_PATH", path);
416417
compiler.env("UNSTABLE_RUSTDOC_TEST_LINE", format!("{}", line as isize - line_offset as isize));
@@ -950,6 +951,7 @@ pub(crate) struct IndividualTestOptions {
950951
runtool_args: Vec<String>,
951952
target: TargetTriple,
952953
test_id: String,
954+
maybe_sysroot: Option<PathBuf>,
953955
}
954956

955957
impl IndividualTestOptions {
@@ -982,6 +984,7 @@ impl IndividualTestOptions {
982984
runtool_args: options.runtool_args.clone(),
983985
target: options.target.clone(),
984986
test_id,
987+
maybe_sysroot: options.maybe_sysroot.clone(),
985988
}
986989
}
987990
}

0 commit comments

Comments
 (0)