@@ -319,13 +319,13 @@ struct IndexPackageV {
319319pub struct RegistryDependency < ' a > {
320320 /// Name of the dependency. If the dependency is renamed, the original
321321 /// would be stored in [`RegistryDependency::package`].
322- pub name : InternedString ,
322+ pub name : Cow < ' a , str > ,
323323 /// The SemVer requirement for this dependency.
324324 #[ serde( borrow) ]
325325 pub req : Cow < ' a , str > ,
326326 /// Set of features enabled for this dependency.
327327 #[ serde( default ) ]
328- pub features : Vec < InternedString > ,
328+ pub features : Vec < Cow < ' a , str > > ,
329329 /// Whether or not this is an optional dependency.
330330 #[ serde( default ) ]
331331 pub optional : bool ,
@@ -340,7 +340,7 @@ pub struct RegistryDependency<'a> {
340340 // `None` if it is from the same index.
341341 pub registry : Option < Cow < ' a , str > > ,
342342 /// The original name if the dependency is renamed.
343- pub package : Option < InternedString > ,
343+ pub package : Option < Cow < ' a , str > > ,
344344 /// Whether or not this is a public dependency. Unstable. See [RFC 1977].
345345 ///
346346 /// [RFC 1977]: https://rust-lang.github.io/rfcs/1977-public-private-dependencies.html
@@ -844,7 +844,11 @@ impl<'a> RegistryDependency<'a> {
844844 default
845845 } ;
846846
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) ?;
848852 if package. is_some ( ) {
849853 dep. set_explicit_name_in_toml ( name) ;
850854 }
@@ -880,6 +884,10 @@ impl<'a> RegistryDependency<'a> {
880884 dep. set_artifact ( artifact) ;
881885 }
882886
887+ let features = features
888+ . iter ( )
889+ . map ( |f| InternedString :: new ( & f) )
890+ . collect :: < Vec < _ > > ( ) ;
883891 dep. set_optional ( optional)
884892 . set_default_features ( default_features)
885893 . set_features ( features)
0 commit comments