@@ -62,11 +62,39 @@ pub struct Crate {
62
62
pub deps : Vec < Dependency > ,
63
63
pub cksum : String ,
64
64
pub features : HashMap < String , Vec < String > > ,
65
+ /// This field contains features with new, extended syntax. Specifically,
66
+ /// namespaced features (`dep:`) and weak dependencies (`pkg?/feat`).
67
+ ///
68
+ /// It is only populated if a feature uses the new syntax. Cargo merges it
69
+ /// on top of the `features` field when reading the entries.
70
+ ///
71
+ /// This is separated from `features` because versions older than 1.19
72
+ /// will fail to load due to not being able to parse the new syntax, even
73
+ /// with a `Cargo.lock` file.
65
74
#[ serde( skip_serializing_if = "Option::is_none" ) ]
66
75
pub features2 : Option < HashMap < String , Vec < String > > > ,
67
76
pub yanked : Option < bool > ,
68
77
#[ serde( default ) ]
69
78
pub links : Option < String > ,
79
+ /// The schema version for this entry.
80
+ ///
81
+ /// If this is None, it defaults to version 1. Entries with unknown
82
+ /// versions are ignored by cargo starting with 1.51.
83
+ ///
84
+ /// Version `2` format adds the `features2` field.
85
+ ///
86
+ /// This provides a method to safely introduce changes to index entries
87
+ /// and allow older versions of cargo to ignore newer entries it doesn't
88
+ /// understand. This is honored as of 1.51, so unfortunately older
89
+ /// versions will ignore it, and potentially misinterpret version 2 and
90
+ /// newer entries.
91
+ ///
92
+ /// The intent is that versions older than 1.51 will work with a
93
+ /// pre-existing `Cargo.lock`, but they may not correctly process `cargo
94
+ /// update` or build a lock from scratch. In that case, cargo may
95
+ /// incorrectly select a new package that uses a new index format. A
96
+ /// workaround is to downgrade any packages that are incompatible with the
97
+ /// `--precise` flag of `cargo update`.
70
98
#[ serde( skip_serializing_if = "Option::is_none" ) ]
71
99
pub v : Option < u32 > ,
72
100
}
0 commit comments