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

Added required_features for issue #1570. #3667

Merged
merged 5 commits into from
Feb 11, 2017

Conversation

jbendig
Copy link
Contributor

@jbendig jbendig commented Feb 8, 2017

Based on PR #2056 by @tsurai and PR #2325 by @JanLikar

I tried to fix most everything that was talked about in the previous pull requests. Docs still need to be updated though.

@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 @brson (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.

@alexcrichton
Copy link
Member

This looks fantastic and quite thorough to me, thanks @jbendig! I think with updates to the manifest docs this is good to go!

cc @rust-lang/tools, a neat feature being added to cargo!

@alexcrichton alexcrichton added the relnotes Release-note worthy label Feb 8, 2017
@alexcrichton alexcrichton assigned alexcrichton and unassigned brson Feb 8, 2017
@alexcrichton
Copy link
Member

Oh and the Travis tests look to be failing, but you can just add if !::is_nightly() checks (or similar) to the tests

@jbendig
Copy link
Contributor Author

jbendig commented Feb 8, 2017

Thanks @alexcrichton! I used your !is_nightly() advice to fix the tests. The nightly features are still so irresistible that I forgot about stable and running tests against it.

I added an explanation for required-features as a sub-section to Configuring a target. This seems like the best place because the toml block already there is more [lib] specific and The [features] section seems more about features in general. Any thoughts or preferences?

let mut compatible_targets = Vec::with_capacity(targets.len());
for (target, profile) in targets.drain(0..) {
if target.is_lib() || match target.required_features() {
Some(f) => !f.iter().any(|f| !features.contains(f)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps instead of the double-negation here we could go for f.iter().all(...)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's definitely more readable.

@alexcrichton
Copy link
Member

Looks fantastic!

Can you also add one more tests which emulates cargo install with required-features? Just to make sure that binaries not activated don't get installed and activated binaries do indeed get installed.

@jbendig
Copy link
Contributor Author

jbendig commented Feb 10, 2017

Good idea. I'll try and make these changes later today.

@alexcrichton
Copy link
Member

@bors: r+

Awesome, thanks @jbendig!

@bors
Copy link
Collaborator

bors commented Feb 10, 2017

📌 Commit d43fd2e has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Feb 10, 2017

⌛ Testing commit d43fd2e with merge 1b39da7...

bors added a commit that referenced this pull request Feb 10, 2017
Added required_features for issue #1570.

Based on PR #2056 by @tsurai and PR #2325 by @JanLikar

I tried to fix most everything that was talked about in the previous pull requests. Docs still need to be updated though.
@bors
Copy link
Collaborator

bors commented Feb 11, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 1b39da7 to master...

@bors bors merged commit d43fd2e into rust-lang:master Feb 11, 2017
@jbendig jbendig deleted the required_features branch February 11, 2017 00:40
@pthariensflame
Copy link

Saw this on TWiR: how does this interact with default features?

@alexcrichton
Copy link
Member

@pthariensflame it shouldn't interact directly, this reads activated features after they've been decided and then dictates whether the binaries/examples are compiled

@pthariensflame
Copy link

Oh, ok.

@ehuss ehuss added this to the 1.17.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Release-note worthy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants