about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-11-03 19:32:44 +0100
committerGitHub <noreply@github.com>2020-11-03 19:32:44 +0100
commita65507b47da110cc4a998036a18aaea77f8ddb81 (patch)
tree701e3374626a1067dca5b9cefe0e5ea4156e1374
parentf9dd8d37c2c19f763443a615c47add896bb933bb (diff)
parent2172adbd5c42eee3926939f93e557bdb2eb1df95 (diff)
downloadrust-a65507b47da110cc4a998036a18aaea77f8ddb81.tar.gz
rust-a65507b47da110cc4a998036a18aaea77f8ddb81.zip
Rollup merge of #78709 - ehuss:fix-in_tree_crates-non-member, r=Mark-Simulacrum
Fix panic in bootstrap for non-workspace path dependencies.

If you add a `path` dependency to a `Cargo.toml` that is located outside of the workspace, then the `in_tree_crates` function can panic because it finds a path dependency that is not defined (since it uses `cargo metadata --no-deps`).  This fixes it by skipping over those entries, which are usually not things you select on the command-line.

Fixes #78617
-rw-r--r--src/bootstrap/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 593d1c4ae88..0878b0ff789 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1119,6 +1119,10 @@ impl Build {
             let krate = &self.crates[&krate];
             ret.push(krate);
             for dep in &krate.deps {
+                if !self.crates.contains_key(dep) {
+                    // Ignore non-workspace members.
+                    continue;
+                }
                 // Don't include optional deps if their features are not
                 // enabled. Ideally this would be computed from `cargo
                 // metadata --features …`, but that is somewhat slow. Just