-
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
Don't download dependencies from other platforms #3123
Conversation
if different platforms have a dependency to a different version of a crate, only the correct dependency should be downloaded and used
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@@ -229,6 +229,38 @@ fn works_through_the_registry() { | |||
} | |||
|
|||
#[test] | |||
fn ignore_version_from_other_platform() { |
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 unittest is based on the two tests above. Both of them include if !is_nightly() { return }
. It seems to work fine on rust 1.11, so I did not include that here.
@bors: r+ Thanks! |
📌 Commit 0a4fbbf has been approved by |
Don't download dependencies from other platforms Having a Cargo.toml which looks like this: [package] name = "a" version = "0.0.1" authors = [] [target.'cfg(unix)'.dependencies] foo = "0.1.0" [target.'cfg(windows)'.dependencies] foo = "0.2.0" This would still download foo version 0.2.0 on unix. I think there is no need to do that, but please correct me if I'm wrong. This was triggered by [this](http://stackoverflow.com/questions/39709542/why-does-the-last-platform-specific-dependency-take-precedence-in-cargo) stackoverflow question, but that situation is more complicated, as the version is the same, just the features are different. This PR will not solve that bug. If you want me to include that too, I would have to debug a bit more first....
☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
Having a Cargo.toml which looks like this:
This would still download foo version 0.2.0 on unix. I think there is no need to do that, but please correct me if I'm wrong.
This was triggered by this stackoverflow question, but that situation is more complicated, as the version is the same, just the features are different. This PR will not solve that bug. If you want me to include that too, I would have to debug a bit more first....