-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support registry dependencies for bindeps #12062
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
868b2f9
to
49d0157
Compare
☔ The latest upstream changes (presumably #12057) made this pull request unmergeable. Please resolve the merge conflicts. |
49d0157
to
7a4a594
Compare
cc @ehuss I implemented this based on the things you have written for that issue. It's from over a year ago so things probably have changed. The most apparent issue with the current change is that we can't really try to download best effort in It could be possible to split |
Looks like I can pass a |
r? ehuss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that it looks like download_accessible
doesn't backtrack. That is, for example, you have the following scenario:
# foo/Cargo.toml
[dependencies]
shared = "1"
with-target = "1"
# shared/Cargo.toml
[dependencies]
bar = "1"
[target.'wasm32-unknown-unknown'.dependencies]
regex = "1"
# with-target/Cargo.toml
[dependencies]
shared = {version = "1", target = "wasm32-unknown-unknown"}
When it traverses foo
, it sees shared
and recurses into it. Target wasm32-unknown-unknown
is not in requested_kinds
or additional_kinds
, so it does not download regex
.
Then it recurses into with-target
. It sees shared
, recurses into it, but since shared
is already in the used
set, it is skipped. regex
never gets downloaded.
Does it support that case?
src/cargo/ops/resolve.rs
Outdated
@@ -198,10 +198,32 @@ pub fn resolve_ws_with_opts<'cfg>( | |||
&member_ids, | |||
has_dev_units, | |||
requested_targets, | |||
target_data, | |||
&mut *target_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this reborrow is necessary.
&mut *target_data, | |
target_data, |
src/cargo/core/package.rs
Outdated
@@ -514,10 +515,23 @@ impl<'cfg> PackageSet<'cfg> { | |||
resolve, | |||
has_dev_units, | |||
requested_kinds, | |||
target_data, | |||
&*target_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reborrow also doesn't seem to be necessary.
&*target_data, | |
target_data, |
let activated = requested_kinds | ||
.iter() | ||
.chain(Some(&CompileKind::Host)) | ||
.chain(additional_kinds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about chaining requested kinds + additional kinds. It seems like that could invite situations where it will download things it doesn't need. We've had some issues filed where cargo downloads too much (#11352), and it seems like this could make that worse.
Am I understanding correctly that this is creating a union of all possibilities, even if not all of them are used?
This seems to step on my fears of making download_accessible
just as complicated as FeatureResolver
in order to download the correct things, and I'm not sure how to balance that or if there are different approaches this can take.
.default_kind() | ||
.into_iter() | ||
.chain(pkg.manifest().forced_kind()) | ||
.chain(artifact_targets(pkg)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, what situations would need to merge artifact_targets
here? My initial thought is that they should have all already been merged during download_accessible
.
@rustbot author |
a9ba8af
to
8aa49b8
Compare
that was just a rebase. No work yet |
And then go through each packages and add their per-pkg-targets and artifact dependency targets to the `RustcTargetData`.
8aa49b8
to
c53917a
Compare
Support dependencies from registries for artifact dependencies, take 2 This is a continuation of #12062, and closes #10405. r? `@ehuss` Here are things this PR changes: 1. Add information about artifact dependencies to the index. This bumps index_v to 3 for people using bindeps. 2. Make `RustcTargetData` mutable for the feature resolver. This is so that we can query rustc for target info as late as resolving features, as that is when we really know if a package is really going to be used.
This closes #10405.
Still need to add tests.