@@ -62,7 +62,7 @@ use crate::util::errors::CargoResult;
6262use crate :: util:: profile;
6363
6464use self :: context:: { Activations , Context } ;
65- use self :: dep_cache:: RegistryQueryer ;
65+ use self :: dep_cache:: { DepsCache , RegistryQueryer } ;
6666use self :: types:: { Candidate , ConflictMap , ConflictReason , DepsFrame } ;
6767use self :: types:: { RcVecIter , RemainingDeps , ResolverProgress } ;
6868
@@ -134,7 +134,8 @@ pub fn resolve(
134134 Some ( config) => config. cli_unstable ( ) . minimal_versions ,
135135 None => false ,
136136 } ;
137- let mut registry = RegistryQueryer :: new ( registry, replacements, try_to_use, minimal_versions) ;
137+ let registry = RegistryQueryer :: new ( registry, replacements, try_to_use, minimal_versions) ;
138+ let mut registry = DepsCache :: new ( registry) ;
138139 let cx = activate_deps_loop ( cx, & mut registry, summaries, config) ?;
139140
140141 let mut cksums = HashMap :: new ( ) ;
@@ -144,7 +145,7 @@ pub fn resolve(
144145 }
145146 let resolve = Resolve :: new (
146147 cx. graph ( ) ,
147- cx. resolve_replacements ( & registry) ,
148+ cx. resolve_replacements ( & registry. registry ) ,
148149 cx. resolve_features
149150 . iter ( )
150151 . map ( |( k, v) | ( * k, v. iter ( ) . map ( |x| x. to_string ( ) ) . collect ( ) ) )
@@ -168,7 +169,7 @@ pub fn resolve(
168169/// dependency graph, cx.resolve is returned.
169170fn activate_deps_loop (
170171 mut cx : Context ,
171- registry : & mut RegistryQueryer < ' _ > ,
172+ registry : & mut DepsCache < ' _ > ,
172173 summaries : & [ ( Summary , Method ) ] ,
173174 config : Option < & Config > ,
174175) -> CargoResult < Context > {
@@ -186,7 +187,7 @@ fn activate_deps_loop(
186187 summary : summary. clone ( ) ,
187188 replace : None ,
188189 } ;
189- let res = activate ( & mut cx, registry, None , candidate, method) ;
190+ let res = activate ( & mut cx, registry, None , candidate, method. clone ( ) ) ;
190191 match res {
191192 Ok ( Some ( ( frame, _) ) ) => remaining_deps. push ( frame) ,
192193 Ok ( None ) => ( ) ,
@@ -328,7 +329,7 @@ fn activate_deps_loop(
328329 debug ! ( "no candidates found" ) ;
329330 Err ( errors:: activation_error (
330331 & cx,
331- registry. registry ,
332+ registry. registry . registry ,
332333 & parent,
333334 & dep,
334335 & conflicting_activations,
@@ -385,7 +386,7 @@ fn activate_deps_loop(
385386 dep. package_name( ) ,
386387 candidate. summary. version( )
387388 ) ;
388- let res = activate ( & mut cx, registry, Some ( ( & parent, & dep) ) , candidate, & method) ;
389+ let res = activate ( & mut cx, registry, Some ( ( & parent, & dep) ) , candidate, method) ;
389390
390391 let successfully_activated = match res {
391392 // Success! We've now activated our `candidate` in our context
@@ -594,10 +595,10 @@ fn activate_deps_loop(
594595/// iterate through next.
595596fn activate (
596597 cx : & mut Context ,
597- registry : & mut RegistryQueryer < ' _ > ,
598+ registry : & mut DepsCache < ' _ > ,
598599 parent : Option < ( & Summary , & Dependency ) > ,
599600 candidate : Candidate ,
600- method : & Method ,
601+ method : Method ,
601602) -> ActivateResult < Option < ( DepsFrame , Duration ) > > {
602603 let candidate_pid = candidate. summary . package_id ( ) ;
603604 if let Some ( ( parent, dep) ) = parent {
@@ -658,11 +659,11 @@ fn activate(
658659 }
659660 }
660661
661- let activated = cx. flag_activated ( & candidate. summary , method) ?;
662+ let activated = cx. flag_activated ( & candidate. summary , & method) ?;
662663
663664 let candidate = match candidate. replace {
664665 Some ( replace) => {
665- if cx. flag_activated ( & replace, method) ? && activated {
666+ if cx. flag_activated ( & replace, & method) ? && activated {
666667 return Ok ( None ) ;
667668 }
668669 trace ! (
@@ -682,12 +683,8 @@ fn activate(
682683 } ;
683684
684685 let now = Instant :: now ( ) ;
685- let ( used_features, deps) = dep_cache:: build_deps (
686- registry,
687- parent. map ( |p| p. 0 . package_id ( ) ) ,
688- & candidate,
689- method,
690- ) ?;
686+ let ( used_features, deps) =
687+ & * registry. build_deps ( parent. map ( |p| p. 0 . package_id ( ) ) , & candidate, & method) ?;
691688
692689 // Record what list of features is active for this package.
693690 if !used_features. is_empty ( ) {
@@ -702,7 +699,7 @@ fn activate(
702699 let frame = DepsFrame {
703700 parent : candidate,
704701 just_for_error_messages : false ,
705- remaining_siblings : RcVecIter :: new ( Rc :: new ( deps) ) ,
702+ remaining_siblings : RcVecIter :: new ( Rc :: clone ( deps) ) ,
706703 } ;
707704 Ok ( Some ( ( frame, now. elapsed ( ) ) ) )
708705}
@@ -862,7 +859,7 @@ impl RemainingCandidates {
862859/// Panics if the input conflict is not all active in `cx`.
863860fn generalize_conflicting (
864861 cx : & Context ,
865- registry : & mut RegistryQueryer < ' _ > ,
862+ registry : & mut DepsCache < ' _ > ,
866863 past_conflicting_activations : & mut conflict_cache:: ConflictCache ,
867864 parent : & Summary ,
868865 dep : & Dependency ,
@@ -901,6 +898,7 @@ fn generalize_conflicting(
901898 // Thus, if all the things it can resolve to have already ben determined
902899 // to be conflicting, then we can just say that we conflict with the parent.
903900 if registry
901+ . registry
904902 . query ( critical_parents_dep)
905903 . expect ( "an already used dep now error!?" )
906904 . iter ( )
0 commit comments