Skip to content

Commit 349d264

Browse files
committed
Add required-features to SerializedTarget
This will add it to `cargo metadata` output and will make it possible to enable features needed to build specific target.
1 parent 8b6f710 commit 349d264

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cargo/core/manifest.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ struct SerializedTarget<'a> {
229229
name: &'a str,
230230
src_path: &'a PathBuf,
231231
edition: &'a str,
232+
#[serde(skip_serializing_if = "Option::is_none")]
233+
required_features: Option<Vec<&'a str>>,
232234
}
233235

234236
impl ser::Serialize for Target {
@@ -238,7 +240,11 @@ impl ser::Serialize for Target {
238240
crate_types: self.rustc_crate_types(),
239241
name: &self.name,
240242
src_path: &self.src_path.path,
241-
edition: &self.edition.to_string()
243+
edition: &self.edition.to_string(),
244+
required_features: self
245+
.required_features
246+
.as_ref()
247+
.map(|rf| rf.iter().map(|s| &**s).collect()),
242248
}.serialize(s)
243249
}
244250
}

0 commit comments

Comments
 (0)