@@ -5,7 +5,7 @@ use serde::Serialize;
55use std:: borrow:: Cow ;
66use std:: fmt;
77use std:: path:: PathBuf ;
8- use std:: rc :: Rc ;
8+ use std:: sync :: Arc ;
99use tracing:: trace;
1010
1111use crate :: core:: compiler:: { CompileKind , CompileTarget } ;
@@ -18,7 +18,7 @@ use crate::util::OptVersionReq;
1818/// Cheap to copy.
1919#[ derive( PartialEq , Eq , Hash , Clone , Debug ) ]
2020pub struct Dependency {
21- inner : Rc < Inner > ,
21+ inner : Arc < Inner > ,
2222}
2323
2424/// The data underlying a `Dependency`.
@@ -152,7 +152,7 @@ impl Dependency {
152152
153153 let mut ret = Dependency :: new_override ( name, source_id) ;
154154 {
155- let ptr = Rc :: make_mut ( & mut ret. inner ) ;
155+ let ptr = Arc :: make_mut ( & mut ret. inner ) ;
156156 ptr. only_match_name = false ;
157157 ptr. req = version_req;
158158 ptr. specified_req = specified_req;
@@ -163,7 +163,7 @@ impl Dependency {
163163 pub fn new_override ( name : InternedString , source_id : SourceId ) -> Dependency {
164164 assert ! ( !name. is_empty( ) ) ;
165165 Dependency {
166- inner : Rc :: new ( Inner {
166+ inner : Arc :: new ( Inner {
167167 name,
168168 source_id,
169169 registry_id : None ,
@@ -241,7 +241,7 @@ impl Dependency {
241241 }
242242
243243 pub fn set_registry_id ( & mut self , registry_id : SourceId ) -> & mut Dependency {
244- Rc :: make_mut ( & mut self . inner ) . registry_id = Some ( registry_id) ;
244+ Arc :: make_mut ( & mut self . inner ) . registry_id = Some ( registry_id) ;
245245 self
246246 }
247247
@@ -259,7 +259,7 @@ impl Dependency {
259259 // Setting 'public' only makes sense for normal dependencies
260260 assert_eq ! ( self . kind( ) , DepKind :: Normal ) ;
261261 }
262- Rc :: make_mut ( & mut self . inner ) . public = public;
262+ Arc :: make_mut ( & mut self . inner ) . public = public;
263263 self
264264 }
265265
@@ -286,7 +286,7 @@ impl Dependency {
286286 // Setting 'public' only makes sense for normal dependencies
287287 assert_eq ! ( kind, DepKind :: Normal ) ;
288288 }
289- Rc :: make_mut ( & mut self . inner ) . kind = kind;
289+ Arc :: make_mut ( & mut self . inner ) . kind = kind;
290290 self
291291 }
292292
@@ -295,44 +295,44 @@ impl Dependency {
295295 & mut self ,
296296 features : impl IntoIterator < Item = impl Into < InternedString > > ,
297297 ) -> & mut Dependency {
298- Rc :: make_mut ( & mut self . inner ) . features = features. into_iter ( ) . map ( |s| s. into ( ) ) . collect ( ) ;
298+ Arc :: make_mut ( & mut self . inner ) . features = features. into_iter ( ) . map ( |s| s. into ( ) ) . collect ( ) ;
299299 self
300300 }
301301
302302 /// Sets whether the dependency requests default features of the package.
303303 pub fn set_default_features ( & mut self , default_features : bool ) -> & mut Dependency {
304- Rc :: make_mut ( & mut self . inner ) . default_features = default_features;
304+ Arc :: make_mut ( & mut self . inner ) . default_features = default_features;
305305 self
306306 }
307307
308308 /// Sets whether the dependency is optional.
309309 pub fn set_optional ( & mut self , optional : bool ) -> & mut Dependency {
310- Rc :: make_mut ( & mut self . inner ) . optional = optional;
310+ Arc :: make_mut ( & mut self . inner ) . optional = optional;
311311 self
312312 }
313313
314314 /// Sets the source ID for this dependency.
315315 pub fn set_source_id ( & mut self , id : SourceId ) -> & mut Dependency {
316- Rc :: make_mut ( & mut self . inner ) . source_id = id;
316+ Arc :: make_mut ( & mut self . inner ) . source_id = id;
317317 self
318318 }
319319
320320 /// Sets the version requirement for this dependency.
321321 pub fn set_version_req ( & mut self , req : OptVersionReq ) -> & mut Dependency {
322- Rc :: make_mut ( & mut self . inner ) . req = req;
322+ Arc :: make_mut ( & mut self . inner ) . req = req;
323323 self
324324 }
325325
326326 pub fn set_platform ( & mut self , platform : Option < Platform > ) -> & mut Dependency {
327- Rc :: make_mut ( & mut self . inner ) . platform = platform;
327+ Arc :: make_mut ( & mut self . inner ) . platform = platform;
328328 self
329329 }
330330
331331 pub fn set_explicit_name_in_toml (
332332 & mut self ,
333333 name : impl Into < InternedString > ,
334334 ) -> & mut Dependency {
335- Rc :: make_mut ( & mut self . inner ) . explicit_name_in_toml = Some ( name. into ( ) ) ;
335+ Arc :: make_mut ( & mut self . inner ) . explicit_name_in_toml = Some ( name. into ( ) ) ;
336336 self
337337 }
338338
@@ -346,7 +346,7 @@ impl Dependency {
346346 self . source_id( ) ,
347347 id
348348 ) ;
349- let me = Rc :: make_mut ( & mut self . inner ) ;
349+ let me = Arc :: make_mut ( & mut self . inner ) ;
350350 me. req . lock_to ( id. version ( ) ) ;
351351
352352 // Only update the `precise` of this source to preserve other
@@ -361,7 +361,7 @@ impl Dependency {
361361 /// Mainly used in dependency patching like `[patch]` or `[replace]`, which
362362 /// doesn't need to lock the entire dependency to a specific [`PackageId`].
363363 pub fn lock_version ( & mut self , version : & semver:: Version ) -> & mut Dependency {
364- let me = Rc :: make_mut ( & mut self . inner ) ;
364+ let me = Arc :: make_mut ( & mut self . inner ) ;
365365 me. req . lock_to ( version) ;
366366 self
367367 }
@@ -430,7 +430,7 @@ impl Dependency {
430430 }
431431
432432 pub ( crate ) fn set_artifact ( & mut self , artifact : Artifact ) {
433- Rc :: make_mut ( & mut self . inner ) . artifact = Some ( artifact) ;
433+ Arc :: make_mut ( & mut self . inner ) . artifact = Some ( artifact) ;
434434 }
435435
436436 pub ( crate ) fn artifact ( & self ) -> Option < & Artifact > {
@@ -453,7 +453,7 @@ impl Dependency {
453453/// This information represents a requirement in the package this dependency refers to.
454454#[ derive( PartialEq , Eq , Hash , Clone , Debug ) ]
455455pub struct Artifact {
456- inner : Rc < Vec < ArtifactKind > > ,
456+ inner : Arc < Vec < ArtifactKind > > ,
457457 is_lib : bool ,
458458 target : Option < ArtifactTarget > ,
459459}
@@ -492,7 +492,7 @@ impl Artifact {
492492 . collect :: < Result < Vec < _ > , _ > > ( ) ?,
493493 ) ?;
494494 Ok ( Artifact {
495- inner : Rc :: new ( kinds) ,
495+ inner : Arc :: new ( kinds) ,
496496 is_lib,
497497 target : target. map ( ArtifactTarget :: parse) . transpose ( ) ?,
498498 } )
0 commit comments