Skip to content

Commit a65507b

Browse files
authored
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
2 parents f9dd8d3 + 2172adb commit a65507b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bootstrap/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,10 @@ impl Build {
11191119
let krate = &self.crates[&krate];
11201120
ret.push(krate);
11211121
for dep in &krate.deps {
1122+
if !self.crates.contains_key(dep) {
1123+
// Ignore non-workspace members.
1124+
continue;
1125+
}
11221126
// Don't include optional deps if their features are not
11231127
// enabled. Ideally this would be computed from `cargo
11241128
// metadata --features …`, but that is somewhat slow. Just

0 commit comments

Comments
 (0)