Skip to content
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

Avoid some extra downloads with new feature resolver. #8823

Merged
merged 1 commit into from
Nov 3, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Oct 31, 2020

There are some edge cases with the new feature resolver where it can erroneously trigger a download of a package that is not needed. This is due to the call is_proc_macro which has to downloaded the manifest to check if it is a proc-macro. The main change here is to defer calling is_proc_macro until after dependencies have been filtered. It also avoids calling is_proc_macro if the new feature resolver is enabled, but decouple_host_deps and ignore_inactive_targets are disabled (such as with -Z weak-dep-features), in which case it doesn't matter if it is a proc-macro or not.

Fixes #8776

@rust-highfive
Copy link

r? @Eh2406

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 31, 2020
@Eh2406
Copy link
Contributor

Eh2406 commented Nov 1, 2020

Seems reasonable and it is your area of expertise.

@alexcrichton
Copy link
Member

This is just an interim solution, right? In the sense that once we default new crates to the new features in the new resolver, won't decouple_host_deps always be true?

@ehuss
Copy link
Contributor Author

ehuss commented Nov 2, 2020

No, I intend to keep it mostly the way it is. decouple_host_deps will only be true for projects that set resolver="2".

I would like to transition so that all projects use the new feature resolver, but still in the "old" mode where features are unified (unless you set resolver="2"). This allows things like -Z weak-dep-features to be implemented for everyone.

I'm fairly comfortable with that. All tests pass with the compare option, and I did some independent testing with various workspaces without problem. There is definite risk that there will be edge cases we haven't yet discovered, but I'm comfortable with addressing those when they come up. It also means the feature resolver retains some complexity for backwards compatibility, but there's only about 5 places where it has to check which option is set.

@alexcrichton
Copy link
Member

@bors: r+

Ok makes sense. I'm a little worried that we're trying to optimize the old default (what we have today) and the new default doesn't have the same avenue for optimization (it could be viewed as a regression in that regard?), but in some sense it is what it is!

@bors
Copy link
Contributor

bors commented Nov 3, 2020

📌 Commit 3d5a908 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 3, 2020
@bors
Copy link
Contributor

bors commented Nov 3, 2020

⌛ Testing commit 3d5a908 with merge 862df61...

@bors
Copy link
Contributor

bors commented Nov 3, 2020

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing 862df61 to master...

@bors bors merged commit 862df61 into rust-lang:master Nov 3, 2020
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 5, 2020
Update cargo

7 commits in becb4c282b8f37469efb8f5beda45a5501f9d367..d5556aeb8405b1fe696adb6e297ad7a1f2989b62
2020-10-28 16:41:55 +0000 to 2020-11-04 22:20:36 +0000
- Implement weak dependency features. (rust-lang/cargo#8818)
- Avoid some extra downloads with new feature resolver. (rust-lang/cargo#8823)
- fix: remove install command `$`, for copying friendly (rust-lang/cargo#8828)
- Bump `anyhow` dependency to `1.0.34` in `crates-io` crate (rust-lang/cargo#8826)
- Normalize SourceID in `cargo metadata`. (rust-lang/cargo#8824)
- vendor: correct the path to cargo config (rust-lang/cargo#8822)
- Make host_root return host.root(), not host.dest() (rust-lang/cargo#8819)
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 5, 2020
Update cargo

7 commits in becb4c282b8f37469efb8f5beda45a5501f9d367..d5556aeb8405b1fe696adb6e297ad7a1f2989b62
2020-10-28 16:41:55 +0000 to 2020-11-04 22:20:36 +0000
- Implement weak dependency features. (rust-lang/cargo#8818)
- Avoid some extra downloads with new feature resolver. (rust-lang/cargo#8823)
- fix: remove install command `$`, for copying friendly (rust-lang/cargo#8828)
- Bump `anyhow` dependency to `1.0.34` in `crates-io` crate (rust-lang/cargo#8826)
- Normalize SourceID in `cargo metadata`. (rust-lang/cargo#8824)
- vendor: correct the path to cargo config (rust-lang/cargo#8822)
- Make host_root return host.root(), not host.dest() (rust-lang/cargo#8819)
@ehuss ehuss added this to the 1.49.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New feature resolver triggers extra downloads sometimes.
5 participants