-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #11478 - rvolosatovs:fix/bindeps-target, r=weihanglo
fix: deduplicate dependencies by artifact target ### What does this PR try to resolve? In cases when a compile target is specified for a bindep and the crate depending on it, cargo fails to deduplicate the crate dependencies and attempts to build the dependent crate only once with non-deterministic feature set, which breaks e.g. https://github.com/rvolosatovs/musl-bindep-feature-bug Fix the issue by including the optional artifact compile target in the `Unit` in order to avoid wrongfully deduplicating the dependent crates Fixes #11463 Fixes #10837 Fixes #10525 Note, that this issue is already accounted for by `cargo`, but in different context a similar situation can occur while building the build script, which: 1. may be built for different target than the actual package target 2. may contain dependencies with different feature sets than the same dependencies in the dependency graph of the package itself That's why this PR is simply reusing the existing functionality for deduplication ### How should we test and review this PR? Build https://github.com/rvolosatovs/musl-bindep-feature-bug ### Additional information This is based on analysis by `@weihanglo` in #10837 (comment) I experimented with adding the whole `UnitFor` to the internal unit struct, but that seems unnecessary. It would probably be nicer to refactor `IsArtifact` and instead turn it into a 3-variant enum with a possible compile target, but I decided against that to minimize the diff. Perhaps it's worth a follow-up?
- Loading branch information
Showing
6 changed files
with
458 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,7 @@ pub fn generate_std_roots( | |
/*is_std*/ true, | ||
/*dep_hash*/ 0, | ||
IsArtifact::No, | ||
None, | ||
)); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.