-
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
Feature dependencies #2325
Feature dependencies #2325
Conversation
Fix rust-lang#1570 based on commits from PR rust-lang#2056 by @tsurai to master
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -299,6 +309,7 @@ impl Target { | |||
pub fn crate_name(&self) -> String { self.name.replace("-", "_") } | |||
pub fn src_path(&self) -> &Path { &self.src_path } | |||
pub fn metadata(&self) -> Option<&Metadata> { self.metadata.as_ref() } | |||
pub fn features(&self) -> Option<&Vec<String>> { self.features.as_ref() } |
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.
Could this change to returning Option<&[T]>
instead of Option<&Vec<T>>
? (generally a little more ergonomic)
Thanks @JanLikar! Can you also add some tests involving example and test targets with feature dependencies as well? |
I'm also wondering if we want to rename this key in the manifest because
Thoughts? |
|
Ah and of course cc @rust-lang/tools, surely more opinions! |
No strong opinion but the docs should be updated somewhere. |
It's perhaps most advantageous to take the conservative route for now and have |
Ok, had a chance to chat with @wycats about this, and the conclusion was:
|
Just came across #1570 which led me here - just thought I'd give this a big +1! Very keen to use this |
@mitchmindtree and others, I didn't find enough time to actually complete this, but I think I will be able to in the next couple of days. |
Closing due to inactivity, but feel free to resubmit with fixes! |
I ran into wanting this over the weekend, so I've started looking at taking it over and fixing up the comments. I have never touched the cargo source before, so I might give up, but so far the tweaks have been easy enough |
Awesome! Let me know if you need any help @branan! |
Based on PR rust-lang#2056 by @tsurai and PR rust-lang#2325 by @JanLikar
Fix #1570 based on commits from PR #2056 by @tsurai to master.
test_cargo_test::selective_test_optional_dep
fails withfeatures cannot be modified when the main package is not being built
. Any ideas?