@@ -207,14 +207,14 @@ pub struct IndexPackage<'a> {
207
207
pub deps : Vec < RegistryDependency < ' a > > ,
208
208
/// Set of features defined for the package, i.e., `[features]` table.
209
209
#[ serde( default ) ]
210
- pub features : BTreeMap < InternedString , Vec < InternedString > > ,
210
+ pub features : BTreeMap < Cow < ' a , str > , Vec < Cow < ' a , str > > > ,
211
211
/// This field contains features with new, extended syntax. Specifically,
212
212
/// namespaced features (`dep:`) and weak dependencies (`pkg?/feat`).
213
213
///
214
214
/// This is separated from `features` because versions older than 1.19
215
215
/// will fail to load due to not being able to parse the new syntax, even
216
216
/// with a `Cargo.lock` file.
217
- pub features2 : Option < BTreeMap < InternedString , Vec < InternedString > > > ,
217
+ pub features2 : Option < BTreeMap < Cow < ' a , str > , Vec < Cow < ' a , str > > > > ,
218
218
/// Checksum for verifying the integrity of the corresponding downloaded package.
219
219
pub cksum : String ,
220
220
/// If `true`, Cargo will skip this version when resolving.
@@ -276,9 +276,21 @@ impl IndexPackage<'_> {
276
276
let mut features = self . features . clone ( ) ;
277
277
if let Some ( features2) = & self . features2 {
278
278
for ( name, values) in features2 {
279
- features. entry ( * name) . or_default ( ) . extend ( values) ;
279
+ features
280
+ . entry ( name. clone ( ) )
281
+ . or_default ( )
282
+ . extend ( values. iter ( ) . cloned ( ) ) ;
280
283
}
281
284
}
285
+ let features = features
286
+ . into_iter ( )
287
+ . map ( |( name, values) | {
288
+ (
289
+ InternedString :: new ( & name) ,
290
+ values. iter ( ) . map ( |v| InternedString :: new ( & v) ) . collect ( ) ,
291
+ )
292
+ } )
293
+ . collect :: < BTreeMap < _ , _ > > ( ) ;
282
294
let mut summary = Summary :: new (
283
295
pkgid,
284
296
deps,
0 commit comments