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

Don't download dependencies from other platforms #3123

Merged
merged 2 commits into from
Sep 27, 2016

Conversation

wimh
Copy link
Contributor

@wimh wimh commented Sep 26, 2016

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 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....

if different platforms have a dependency to a different
version of a crate, only the correct dependency should
be downloaded and used
@rust-highfive
Copy link

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() {
Copy link
Contributor Author

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.

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Collaborator

bors commented Sep 27, 2016

📌 Commit 0a4fbbf has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Sep 27, 2016

⌛ Testing commit 0a4fbbf with merge 22bd52d...

bors added a commit that referenced this pull request Sep 27, 2016
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....
@bors
Copy link
Collaborator

bors commented Sep 27, 2016

☀️ 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
Approved by: alexcrichton
Pushing 22bd52d to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants