Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cargo/sources/registry/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ pub struct IndexPackage<'a> {
#[serde(borrow)]
pub deps: Vec<RegistryDependency<'a>>,
/// Set of features defined for the package, i.e., `[features]` table.
#[serde(default)]
pub features: BTreeMap<InternedString, Vec<InternedString>>,
/// This field contains features with new, extended syntax. Specifically,
/// namespaced features (`dep:`) and weak dependencies (`pkg?/feat`).
Expand Down Expand Up @@ -268,10 +269,13 @@ pub struct RegistryDependency<'a> {
#[serde(borrow)]
pub req: Cow<'a, str>,
/// Set of features enabled for this dependency.
#[serde(default)]
pub features: Vec<InternedString>,
/// Whether or not this is an optional dependency.
#[serde(default)]
pub optional: bool,
/// Whether or not default features are enabled.
#[serde(default = "default_true")]
pub default_features: bool,
/// The target platform for this dependency.
pub target: Option<Cow<'a, str>>,
Expand All @@ -292,6 +296,10 @@ pub struct RegistryDependency<'a> {
pub lib: bool,
}

fn default_true() -> bool {
true
}

impl<'gctx> RegistryIndex<'gctx> {
/// Creates an empty registry index at `path`.
pub fn new(
Expand Down