Skip to content

Commit

Permalink
Auto merge of #7424 - alexcrichton:beta-next, r=ehuss
Browse files Browse the repository at this point in the history
[beta] Backport two changes to 1.39.0

This is a backport of:

* #7394
* #7419
  • Loading branch information
bors committed Sep 24, 2019
2 parents b6c6f68 + f393130 commit 7d1d5fd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
.filter(|unit| {
// Binaries aren't actually needed to *compile* tests, just to run
// them, so we don't include this dependency edge in the job graph.
!unit.target.is_test() || !unit.target.is_bin()
!unit.target.is_test() && !unit.target.is_bin()
})
.map(|dep| {
// Handle the case here where our `unit -> dep` dependency may
Expand Down
10 changes: 5 additions & 5 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ pub trait AppExt: Sized {
}

fn arg_features(self) -> Self {
self._arg(
opt("features", "Space-separated list of features to activate")
.multiple(true)
.value_name("FEATURES"),
)
self._arg(multi_opt(
"features",
"FEATURES",
"Space-separated list of features to activate",
))
._arg(opt("all-features", "Activate all available features"))
._arg(opt(
"no-default-features",
Expand Down
29 changes: 29 additions & 0 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1959,3 +1959,32 @@ fn multi_multi_features() {

p.cargo("build --features a --features").arg("b c").run();
}

#[cargo_test]
fn cli_parse_ok() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
[features]
a = []
"#,
)
.file(
"src/main.rs",
r#"
#[cfg(feature = "a")]
fn main() {
assert_eq!(std::env::args().nth(1).unwrap(), "b");
}
"#,
)
.build();

p.cargo("run --features a b").run();
}

0 comments on commit 7d1d5fd

Please sign in to comment.