1
Fork 0

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
This commit is contained in:
bors 2019-06-30 01:44:44 +00:00
commit fd7f48b3ef

View file

@ -44,8 +44,7 @@ pub fn run(options: Options) -> i32 {
let input = config::Input::File(options.input.clone()); let input = config::Input::File(options.input.clone());
let sessopts = config::Options { let sessopts = config::Options {
maybe_sysroot: options.maybe_sysroot.clone().or_else( maybe_sysroot: options.maybe_sysroot.clone(),
|| Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())),
search_paths: options.libs.clone(), search_paths: options.libs.clone(),
crate_types: vec![config::CrateType::Dylib], crate_types: vec![config::CrateType::Dylib],
cg: options.codegen_options.clone(), cg: options.codegen_options.clone(),
@ -225,8 +224,7 @@ fn run_test(
let outputs = OutputTypes::new(&[(OutputType::Exe, None)]); let outputs = OutputTypes::new(&[(OutputType::Exe, None)]);
let sessopts = config::Options { let sessopts = config::Options {
maybe_sysroot: maybe_sysroot.or_else( maybe_sysroot,
|| Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())),
search_paths: libs, search_paths: libs,
crate_types: vec![config::CrateType::Executable], crate_types: vec![config::CrateType::Executable],
output_types: outputs, output_types: outputs,