@@ -62,7 +62,7 @@ use crate::util::errors::CargoResult;
62
62
use crate :: util:: profile;
63
63
64
64
use self :: context:: { Activations , Context } ;
65
- use self :: dep_cache:: RegistryQueryer ;
65
+ use self :: dep_cache:: { DepsCache , RegistryQueryer } ;
66
66
use self :: types:: { Candidate , ConflictMap , ConflictReason , DepsFrame } ;
67
67
use self :: types:: { RcVecIter , RemainingDeps , ResolverProgress } ;
68
68
@@ -134,7 +134,8 @@ pub fn resolve(
134
134
Some ( config) => config. cli_unstable ( ) . minimal_versions ,
135
135
None => false ,
136
136
} ;
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) ;
138
139
let cx = activate_deps_loop ( cx, & mut registry, summaries, config) ?;
139
140
140
141
let mut cksums = HashMap :: new ( ) ;
@@ -144,7 +145,7 @@ pub fn resolve(
144
145
}
145
146
let resolve = Resolve :: new (
146
147
cx. graph ( ) ,
147
- cx. resolve_replacements ( & registry) ,
148
+ cx. resolve_replacements ( & registry. registry ) ,
148
149
cx. resolve_features
149
150
. iter ( )
150
151
. map ( |( k, v) | ( * k, v. iter ( ) . map ( |x| x. to_string ( ) ) . collect ( ) ) )
@@ -168,7 +169,7 @@ pub fn resolve(
168
169
/// dependency graph, cx.resolve is returned.
169
170
fn activate_deps_loop (
170
171
mut cx : Context ,
171
- registry : & mut RegistryQueryer < ' _ > ,
172
+ registry : & mut DepsCache < ' _ > ,
172
173
summaries : & [ ( Summary , Method ) ] ,
173
174
config : Option < & Config > ,
174
175
) -> CargoResult < Context > {
@@ -186,7 +187,7 @@ fn activate_deps_loop(
186
187
summary : summary. clone ( ) ,
187
188
replace : None ,
188
189
} ;
189
- let res = activate ( & mut cx, registry, None , candidate, method) ;
190
+ let res = activate ( & mut cx, registry, None , candidate, method. clone ( ) ) ;
190
191
match res {
191
192
Ok ( Some ( ( frame, _) ) ) => remaining_deps. push ( frame) ,
192
193
Ok ( None ) => ( ) ,
@@ -328,7 +329,7 @@ fn activate_deps_loop(
328
329
debug ! ( "no candidates found" ) ;
329
330
Err ( errors:: activation_error (
330
331
& cx,
331
- registry. registry ,
332
+ registry. registry . registry ,
332
333
& parent,
333
334
& dep,
334
335
& conflicting_activations,
@@ -385,7 +386,7 @@ fn activate_deps_loop(
385
386
dep. package_name( ) ,
386
387
candidate. summary. version( )
387
388
) ;
388
- let res = activate ( & mut cx, registry, Some ( ( & parent, & dep) ) , candidate, & method) ;
389
+ let res = activate ( & mut cx, registry, Some ( ( & parent, & dep) ) , candidate, method) ;
389
390
390
391
let successfully_activated = match res {
391
392
// Success! We've now activated our `candidate` in our context
@@ -594,10 +595,10 @@ fn activate_deps_loop(
594
595
/// iterate through next.
595
596
fn activate (
596
597
cx : & mut Context ,
597
- registry : & mut RegistryQueryer < ' _ > ,
598
+ registry : & mut DepsCache < ' _ > ,
598
599
parent : Option < ( & Summary , & Dependency ) > ,
599
600
candidate : Candidate ,
600
- method : & Method ,
601
+ method : Method ,
601
602
) -> ActivateResult < Option < ( DepsFrame , Duration ) > > {
602
603
let candidate_pid = candidate. summary . package_id ( ) ;
603
604
if let Some ( ( parent, dep) ) = parent {
@@ -658,11 +659,11 @@ fn activate(
658
659
}
659
660
}
660
661
661
- let activated = cx. flag_activated ( & candidate. summary , method) ?;
662
+ let activated = cx. flag_activated ( & candidate. summary , & method) ?;
662
663
663
664
let candidate = match candidate. replace {
664
665
Some ( replace) => {
665
- if cx. flag_activated ( & replace, method) ? && activated {
666
+ if cx. flag_activated ( & replace, & method) ? && activated {
666
667
return Ok ( None ) ;
667
668
}
668
669
trace ! (
@@ -682,12 +683,8 @@ fn activate(
682
683
} ;
683
684
684
685
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) ?;
691
688
692
689
// Record what list of features is active for this package.
693
690
if !used_features. is_empty ( ) {
@@ -702,7 +699,7 @@ fn activate(
702
699
let frame = DepsFrame {
703
700
parent : candidate,
704
701
just_for_error_messages : false ,
705
- remaining_siblings : RcVecIter :: new ( Rc :: new ( deps) ) ,
702
+ remaining_siblings : RcVecIter :: new ( Rc :: clone ( deps) ) ,
706
703
} ;
707
704
Ok ( Some ( ( frame, now. elapsed ( ) ) ) )
708
705
}
@@ -862,7 +859,7 @@ impl RemainingCandidates {
862
859
/// Panics if the input conflict is not all active in `cx`.
863
860
fn generalize_conflicting (
864
861
cx : & Context ,
865
- registry : & mut RegistryQueryer < ' _ > ,
862
+ registry : & mut DepsCache < ' _ > ,
866
863
past_conflicting_activations : & mut conflict_cache:: ConflictCache ,
867
864
parent : & Summary ,
868
865
dep : & Dependency ,
@@ -901,6 +898,7 @@ fn generalize_conflicting(
901
898
// Thus, if all the things it can resolve to have already ben determined
902
899
// to be conflicting, then we can just say that we conflict with the parent.
903
900
if registry
901
+ . registry
904
902
. query ( critical_parents_dep)
905
903
. expect ( "an already used dep now error!?" )
906
904
. iter ( )
0 commit comments