mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 19:22:33 +00:00
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
This commit is contained in:
parent
7d2b578bc3
commit
1fa02e77b6
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue