Skip to content

Commit fd7f48b

Browse files
committed
Auto merge of #61459 - GuillaumeGomez:fix-rustdoc-sysroot-panic, r=ollie27,bjorn3,QuietMisdreavus
Prevent panic when sysroot cannot be computed Fixes #61377. cc @rotty @rust-lang/rustdoc r? @Manishearth
2 parents 9a90d03 + ab277a4 commit fd7f48b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/librustdoc/test.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ pub fn run(options: Options) -> i32 {
4444
let input = config::Input::File(options.input.clone());
4545

4646
let sessopts = config::Options {
47-
maybe_sysroot: options.maybe_sysroot.clone().or_else(
48-
|| Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())),
47+
maybe_sysroot: options.maybe_sysroot.clone(),
4948
search_paths: options.libs.clone(),
5049
crate_types: vec![config::CrateType::Dylib],
5150
cg: options.codegen_options.clone(),
@@ -225,8 +224,7 @@ fn run_test(
225224
let outputs = OutputTypes::new(&[(OutputType::Exe, None)]);
226225

227226
let sessopts = config::Options {
228-
maybe_sysroot: maybe_sysroot.or_else(
229-
|| Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())),
227+
maybe_sysroot,
230228
search_paths: libs,
231229
crate_types: vec![config::CrateType::Executable],
232230
output_types: outputs,

0 commit comments

Comments
 (0)