From ac4d8ff314f2dac8e604a91632bd58c1c81f7f05 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 20 Sep 2019 13:06:05 -0700 Subject: [PATCH 1/2] Fix integration tests waiting for binaries to finish. Integration tests were waiting for binaries to finish building due to a minor logic error. --- src/cargo/core/compiler/job_queue.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/core/compiler/job_queue.rs b/src/cargo/core/compiler/job_queue.rs index 70d9034075b..004d769d248 100644 --- a/src/cargo/core/compiler/job_queue.rs +++ b/src/cargo/core/compiler/job_queue.rs @@ -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 From f3931302eceb99f9e424fec232ba49a80415a2ae Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Sep 2019 12:49:14 -0700 Subject: [PATCH 2/2] Fix interpretation of `--features a b` on the CLI Fixes an accidental regression from #7084 where `--features a b` was erroneously mistinterpreted as `--features "a b"`. Closes #7418 --- src/cargo/util/command_prelude.rs | 10 +++++----- tests/testsuite/features.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index a5e42dbe438..a403c7efaab 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -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", diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index a167b78185e..5b41064efbd 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -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(); +}