Skip to content

Commit

Permalink
Ignore paths that don't exist for dependencies
Browse files Browse the repository at this point in the history
If a given path is not a valid dependency, just ignore it. This allows
falling back to git or the repository automatically while retaining the
ability to have the code locally if you need to develop a dependency in
tandem with the crate code.

Fixes rust-lang#8747
  • Loading branch information
pedrocr committed Oct 2, 2020
1 parent 75615f8 commit d6cf5f6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1642,9 +1642,23 @@ impl DetailedTomlDependency {
}
}

// Ignore paths that don't exist so as to fallback onto some other
// source in that circumstance. This allows specifying dependencies
// from crates.io or git as well as a local path for development and
// having everything just work.
let path = if let Some(path) = &self.path {
if Path::new(&path).join("Cargo.toml").exists() {
self.path.as_ref()
} else {
None
}
} else {
None
};

let new_source_id = match (
self.git.as_ref(),
self.path.as_ref(),
path,
self.registry.as_ref(),
self.registry_index.as_ref(),
) {
Expand Down

0 comments on commit d6cf5f6

Please sign in to comment.