Drag detached files towards loading

This commit is contained in:
Kirill Bulatov 2021-05-23 20:56:54 +03:00
parent 695569d978
commit de090749d9
6 changed files with 83 additions and 11 deletions

View file

@ -50,7 +50,9 @@ impl Sysroot {
pub fn discover(cargo_toml: &AbsPath) -> Result<Sysroot> {
log::debug!("Discovering sysroot for {}", cargo_toml.display());
let current_dir = cargo_toml.parent().unwrap();
let current_dir = cargo_toml.parent().ok_or_else(|| {
format_err!("Failed to find the parent directory for file {:?}", cargo_toml)
})?;
let sysroot_dir = discover_sysroot_dir(current_dir)?;
let sysroot_src_dir = discover_sysroot_src_dir(&sysroot_dir, current_dir)?;
let res = Sysroot::load(&sysroot_src_dir)?;