@@ -319,13 +319,13 @@ struct IndexPackageV {
319
319
pub struct RegistryDependency < ' a > {
320
320
/// Name of the dependency. If the dependency is renamed, the original
321
321
/// would be stored in [`RegistryDependency::package`].
322
- pub name : InternedString ,
322
+ pub name : Cow < ' a , str > ,
323
323
/// The SemVer requirement for this dependency.
324
324
#[ serde( borrow) ]
325
325
pub req : Cow < ' a , str > ,
326
326
/// Set of features enabled for this dependency.
327
327
#[ serde( default ) ]
328
- pub features : Vec < InternedString > ,
328
+ pub features : Vec < Cow < ' a , str > > ,
329
329
/// Whether or not this is an optional dependency.
330
330
#[ serde( default ) ]
331
331
pub optional : bool ,
@@ -340,7 +340,7 @@ pub struct RegistryDependency<'a> {
340
340
// `None` if it is from the same index.
341
341
pub registry : Option < Cow < ' a , str > > ,
342
342
/// The original name if the dependency is renamed.
343
- pub package : Option < InternedString > ,
343
+ pub package : Option < Cow < ' a , str > > ,
344
344
/// Whether or not this is a public dependency. Unstable. See [RFC 1977].
345
345
///
346
346
/// [RFC 1977]: https://rust-lang.github.io/rfcs/1977-public-private-dependencies.html
@@ -844,7 +844,11 @@ impl<'a> RegistryDependency<'a> {
844
844
default
845
845
} ;
846
846
847
- let mut dep = Dependency :: parse ( package. unwrap_or ( name) , Some ( & req) , id) ?;
847
+ let name = package
848
+ . as_ref ( )
849
+ . map ( |p| InternedString :: new ( & p) )
850
+ . unwrap_or ( InternedString :: new ( & name) ) ;
851
+ let mut dep = Dependency :: parse ( name, Some ( & req) , id) ?;
848
852
if package. is_some ( ) {
849
853
dep. set_explicit_name_in_toml ( name) ;
850
854
}
@@ -880,6 +884,10 @@ impl<'a> RegistryDependency<'a> {
880
884
dep. set_artifact ( artifact) ;
881
885
}
882
886
887
+ let features = features
888
+ . iter ( )
889
+ . map ( |f| InternedString :: new ( & f) )
890
+ . collect :: < Vec < _ > > ( ) ;
883
891
dep. set_optional ( optional)
884
892
. set_default_features ( default_features)
885
893
. set_features ( features)
0 commit comments