let values = match &self.inner.val {
BuildTargetConfigInner::One(s) => vec![map(s)],
BuildTargetConfigInner::Many(v) => {
- if v.len() > 1 && !config.cli_unstable().multitarget {
- bail!("specifying multiple `target` in `build.target` config value requires `-Zmultitarget`")
+ if !config.cli_unstable().multitarget {
+ bail!("specifying an array in `build.target` config value requires `-Zmultitarget`")
} else {
v.iter().map(map).collect()
}
}
#[cargo_test]
-fn double_target_rejected_with_config() {
+fn array_of_target_rejected_with_config() {
let p = project()
.file("Cargo.toml", &basic_manifest("foo", "1.0.0"))
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("build")
- .with_stderr("[ERROR] specifying multiple `target` in `build.target` config value requires `-Zmultitarget`")
+ .with_stderr(
+ "[ERROR] specifying an array in `build.target` config value requires `-Zmultitarget`",
+ )
+ .with_status(101)
+ .run();
+
+ p.change_file(
+ ".cargo/config.toml",
+ r#"
+ [build]
+ target = ["a"]
+ "#,
+ );
+
+ p.cargo("build")
+ .with_stderr(
+ "[ERROR] specifying an array in `build.target` config value requires `-Zmultitarget`",
+ )
.with_status(101)
.run();
}