@@ -207,14 +207,14 @@ pub struct IndexPackage<'a> {
207207 pub deps : Vec < RegistryDependency < ' a > > ,
208208 /// Set of features defined for the package, i.e., `[features]` table.
209209 #[ serde( default ) ]
210- pub features : BTreeMap < InternedString , Vec < InternedString > > ,
210+ pub features : BTreeMap < Cow < ' a , str > , Vec < Cow < ' a , str > > > ,
211211 /// This field contains features with new, extended syntax. Specifically,
212212 /// namespaced features (`dep:`) and weak dependencies (`pkg?/feat`).
213213 ///
214214 /// This is separated from `features` because versions older than 1.19
215215 /// will fail to load due to not being able to parse the new syntax, even
216216 /// 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 > > > > ,
218218 /// Checksum for verifying the integrity of the corresponding downloaded package.
219219 pub cksum : String ,
220220 /// If `true`, Cargo will skip this version when resolving.
@@ -276,9 +276,21 @@ impl IndexPackage<'_> {
276276 let mut features = self . features . clone ( ) ;
277277 if let Some ( features2) = & self . features2 {
278278 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 ( ) ) ;
280283 }
281284 }
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 < _ , _ > > ( ) ;
282294 let mut summary = Summary :: new (
283295 pkgid,
284296 deps,
0 commit comments