-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add feature dependencies to all targets but lib #2056
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wycats (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. 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. |
features.clone() | ||
} | ||
} | ||
); |
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.
The set of activated features for a package is actually best learned through Resolve
which should be available by the time this gets down below I believe.
Thanks! Can you be sure to add some tests for this as well? |
☔ The latest upstream changes (presumably #2068) made this pull request unmergeable. Please resolve the merge conflicts. |
I've made the changes you suggested and added a few tests. Please tell me if those are insufficient. |
@@ -361,6 +363,16 @@ fn generate_targets<'a>(pkg: &'a Package, | |||
Ok(targets) | |||
} | |||
}; | |||
|
|||
targets.map(|x| x.iter().filter_map(|&(t, p)| { |
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.
Hm perhaps this changed from before? It looks like the map
part of filter_map
isn't being used, so this may be able to just be a filter
.
It may also be more clear here to explicitly use if/else instead of a match for the logic, the multi-line guard for one of the arms was a little jarring.
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.
Also, instead of having targets
be of the type CargoResult<Vec<_>>
it's probably best to have it just be Vec<_>
(e.g. remove all the Ok
above) and just wrap it in Ok
after the filtering is done.
Ah and as a final point I think this can use retain
instead of iter
+ filter
+ collect
☔ The latest upstream changes (presumably #2126) made this pull request unmergeable. Please resolve the merge conflicts. |
Is this still being worked on? |
@JanLikar I think this may be going a bit stale, so if you want to pick it up feel free to! |
I am really looking forward to this feature. Any progress on this? |
I think this should be good to go with comments addressed and a rebase, but @ebkalderon if you'd like to spearhead that feel free! |
I'm working on this. |
Fix rust-lang#1570 based on commits from PR rust-lang#2056 by @tsurai to master
Fix rust-lang#1570 based on commits from PR rust-lang#2056 by @tsurai to master
Based on PR rust-lang#2056 by @tsurai and PR rust-lang#2325 by @JanLikar
This small PR adds the ability to use feature dependencies for all targets but lib fixing issue #1570
Please tell me if and how the user should be notified about ignored targets as I am not sure how verbose cargo should be. Big thanks to @alexcrichton for guiding me.
As always, critique is much appreciated.