mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(build-std): parse as comma-separated list
Restore to the behavior prior to 30d11ce1d9f06907d1e707c4fe379ebf57305a5e Also extend `build-std-features` to support comma-separated list.
This commit is contained in:
parent
ffe841c540
commit
93c764d805
@ -759,7 +759,9 @@ unstable_cli_options!(
|
|||||||
avoid_dev_deps: bool = ("Avoid installing dev-dependencies if possible"),
|
avoid_dev_deps: bool = ("Avoid installing dev-dependencies if possible"),
|
||||||
binary_dep_depinfo: bool = ("Track changes to dependency artifacts"),
|
binary_dep_depinfo: bool = ("Track changes to dependency artifacts"),
|
||||||
bindeps: bool = ("Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates"),
|
bindeps: bool = ("Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates"),
|
||||||
|
#[serde(deserialize_with = "deserialize_comma_separated_list")]
|
||||||
build_std: Option<Vec<String>> = ("Enable Cargo to compile the standard library itself as part of a crate graph compilation"),
|
build_std: Option<Vec<String>> = ("Enable Cargo to compile the standard library itself as part of a crate graph compilation"),
|
||||||
|
#[serde(deserialize_with = "deserialize_comma_separated_list")]
|
||||||
build_std_features: Option<Vec<String>> = ("Configure features enabled for the standard library itself when building the standard library"),
|
build_std_features: Option<Vec<String>> = ("Configure features enabled for the standard library itself when building the standard library"),
|
||||||
cargo_lints: bool = ("Enable the `[lints.cargo]` table"),
|
cargo_lints: bool = ("Enable the `[lints.cargo]` table"),
|
||||||
checksum_freshness: bool = ("Use a checksum to determine if output is fresh rather than filesystem mtime"),
|
checksum_freshness: bool = ("Use a checksum to determine if output is fresh rather than filesystem mtime"),
|
||||||
@ -872,6 +874,24 @@ const STABILIZED_LINTS: &str = "The `[lints]` table is now always available.";
|
|||||||
const STABILIZED_CHECK_CFG: &str =
|
const STABILIZED_CHECK_CFG: &str =
|
||||||
"Compile-time checking of conditional (a.k.a. `-Zcheck-cfg`) is now always enabled.";
|
"Compile-time checking of conditional (a.k.a. `-Zcheck-cfg`) is now always enabled.";
|
||||||
|
|
||||||
|
fn deserialize_comma_separated_list<'de, D>(
|
||||||
|
deserializer: D,
|
||||||
|
) -> Result<Option<Vec<String>>, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
let Some(list) = <Option<Vec<String>>>::deserialize(deserializer)? else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
let v = list
|
||||||
|
.iter()
|
||||||
|
.flat_map(|s| s.split(','))
|
||||||
|
.filter(|s| !s.is_empty())
|
||||||
|
.map(String::from)
|
||||||
|
.collect();
|
||||||
|
Ok(Some(v))
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Default, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
|
#[derive(Debug, Copy, Clone, Default, Deserialize, Ord, PartialOrd, Eq, PartialEq)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GitFeatures {
|
pub struct GitFeatures {
|
||||||
|
@ -2175,7 +2175,14 @@ fn build_std() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.build_std
|
.build_std
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(value, vec!["core,std,panic_abort".to_string()]);
|
assert_eq!(
|
||||||
|
value,
|
||||||
|
vec![
|
||||||
|
"core".to_string(),
|
||||||
|
"std".to_string(),
|
||||||
|
"panic_abort".to_string(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
let gctx = GlobalContextBuilder::new()
|
let gctx = GlobalContextBuilder::new()
|
||||||
.config_arg("unstable.build-std=['core', 'std,panic_abort']")
|
.config_arg("unstable.build-std=['core', 'std,panic_abort']")
|
||||||
@ -2188,7 +2195,11 @@ fn build_std() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
value,
|
value,
|
||||||
vec!["core".to_string(), "std,panic_abort".to_string()]
|
vec![
|
||||||
|
"core".to_string(),
|
||||||
|
"std".to_string(),
|
||||||
|
"panic_abort".to_string(),
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
let gctx = GlobalContextBuilder::new()
|
let gctx = GlobalContextBuilder::new()
|
||||||
@ -2205,7 +2216,11 @@ fn build_std() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
value,
|
value,
|
||||||
vec!["backtrace,panic-unwind,windows_raw_dylib".to_string()]
|
vec![
|
||||||
|
"backtrace".to_string(),
|
||||||
|
"panic-unwind".to_string(),
|
||||||
|
"windows_raw_dylib".to_string(),
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
let gctx = GlobalContextBuilder::new()
|
let gctx = GlobalContextBuilder::new()
|
||||||
@ -2221,7 +2236,8 @@ fn build_std() {
|
|||||||
value,
|
value,
|
||||||
vec![
|
vec![
|
||||||
"backtrace".to_string(),
|
"backtrace".to_string(),
|
||||||
"panic-unwind,windows_raw_dylib".to_string()
|
"panic-unwind".to_string(),
|
||||||
|
"windows_raw_dylib".to_string(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user