From ab277a439b75af677877494a13db65b9e4d125ec Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Jun 2019 13:39:50 +0200 Subject: [PATCH] Prevent panic when sysroot cannot be computed --- src/librustdoc/test.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 5bce5d6ba5de1..3df06fc45c066 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -44,8 +44,7 @@ pub fn run(options: Options) -> i32 { let input = config::Input::File(options.input.clone()); let sessopts = config::Options { - maybe_sysroot: options.maybe_sysroot.clone().or_else( - || Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())), + maybe_sysroot: options.maybe_sysroot.clone(), search_paths: options.libs.clone(), crate_types: vec![config::CrateType::Dylib], cg: options.codegen_options.clone(), @@ -225,8 +224,7 @@ fn run_test( let outputs = OutputTypes::new(&[(OutputType::Exe, None)]); let sessopts = config::Options { - maybe_sysroot: maybe_sysroot.or_else( - || Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())), + maybe_sysroot, search_paths: libs, crate_types: vec![config::CrateType::Executable], output_types: outputs,