@@ -62,7 +62,7 @@ use crate::util::profile;
62
62
63
63
use self :: context:: { Activations , Context } ;
64
64
use self :: dep_cache:: RegistryQueryer ;
65
- use self :: types:: { Candidate , ConflictMap , ConflictReason , DepsFrame } ;
65
+ use self :: types:: { ConflictMap , ConflictReason , DepsFrame } ;
66
66
use self :: types:: { FeaturesSet , RcVecIter , RemainingDeps , ResolverProgress } ;
67
67
68
68
pub use self :: encode:: { EncodableDependency , EncodablePackageId , EncodableResolve } ;
@@ -181,11 +181,7 @@ fn activate_deps_loop(
181
181
// Activate all the initial summaries to kick off some work.
182
182
for & ( ref summary, ref method) in summaries {
183
183
debug ! ( "initial activation: {}" , summary. package_id( ) ) ;
184
- let candidate = Candidate {
185
- summary : summary. clone ( ) ,
186
- replace : None ,
187
- } ;
188
- let res = activate ( & mut cx, registry, None , candidate, method. clone ( ) ) ;
184
+ let res = activate ( & mut cx, registry, None , summary. clone ( ) , method. clone ( ) ) ;
189
185
match res {
190
186
Ok ( Some ( ( frame, _) ) ) => remaining_deps. push ( frame) ,
191
187
Ok ( None ) => ( ) ,
@@ -370,7 +366,7 @@ fn activate_deps_loop(
370
366
None
371
367
} ;
372
368
373
- let pid = candidate. summary . package_id ( ) ;
369
+ let pid = candidate. package_id ( ) ;
374
370
let method = Method :: Required {
375
371
dev_deps : false ,
376
372
features : Rc :: clone ( & features) ,
@@ -382,7 +378,7 @@ fn activate_deps_loop(
382
378
parent. name( ) ,
383
379
cur,
384
380
dep. package_name( ) ,
385
- candidate. summary . version( )
381
+ candidate. version( )
386
382
) ;
387
383
let res = activate ( & mut cx, registry, Some ( ( & parent, & dep) ) , candidate, method) ;
388
384
@@ -595,10 +591,10 @@ fn activate(
595
591
cx : & mut Context ,
596
592
registry : & mut RegistryQueryer < ' _ > ,
597
593
parent : Option < ( & Summary , & Dependency ) > ,
598
- candidate : Candidate ,
594
+ candidate : Summary ,
599
595
method : Method ,
600
596
) -> ActivateResult < Option < ( DepsFrame , Duration ) > > {
601
- let candidate_pid = candidate. summary . package_id ( ) ;
597
+ let candidate_pid = candidate. package_id ( ) ;
602
598
if let Some ( ( parent, dep) ) = parent {
603
599
let parent_pid = parent. package_id ( ) ;
604
600
Rc :: make_mut (
@@ -657,9 +653,9 @@ fn activate(
657
653
}
658
654
}
659
655
660
- let activated = cx. flag_activated ( & candidate. summary , & method) ?;
656
+ let activated = cx. flag_activated ( & candidate, & method) ?;
661
657
662
- let candidate = match candidate . replace {
658
+ let candidate = match registry . replacement_summary ( candidate_pid ) {
663
659
Some ( replace) => {
664
660
if cx. flag_activated ( & replace, & method) ? && activated {
665
661
return Ok ( None ) ;
@@ -669,14 +665,14 @@ fn activate(
669
665
replace. package_id( ) ,
670
666
candidate_pid
671
667
) ;
672
- replace
668
+ replace. clone ( )
673
669
}
674
670
None => {
675
671
if activated {
676
672
return Ok ( None ) ;
677
673
}
678
674
trace ! ( "activating {}" , candidate_pid) ;
679
- candidate. summary
675
+ candidate
680
676
}
681
677
} ;
682
678
@@ -727,13 +723,13 @@ struct BacktrackFrame {
727
723
/// filtered out, and as they are filtered the causes will be added to `conflicting_prev_active`.
728
724
#[ derive( Clone ) ]
729
725
struct RemainingCandidates {
730
- remaining : RcVecIter < Candidate > ,
726
+ remaining : RcVecIter < Summary > ,
731
727
// This is a inlined peekable generator
732
- has_another : Option < Candidate > ,
728
+ has_another : Option < Summary > ,
733
729
}
734
730
735
731
impl RemainingCandidates {
736
- fn new ( candidates : & Rc < Vec < Candidate > > ) -> RemainingCandidates {
732
+ fn new ( candidates : & Rc < Vec < Summary > > ) -> RemainingCandidates {
737
733
RemainingCandidates {
738
734
remaining : RcVecIter :: new ( Rc :: clone ( candidates) ) ,
739
735
has_another : None ,
@@ -762,14 +758,14 @@ impl RemainingCandidates {
762
758
cx : & Context ,
763
759
dep : & Dependency ,
764
760
parent : PackageId ,
765
- ) -> Option < ( Candidate , bool ) > {
761
+ ) -> Option < ( Summary , bool ) > {
766
762
' main: for ( _, b) in self . remaining . by_ref ( ) {
767
- let b_id = b. summary . package_id ( ) ;
763
+ let b_id = b. package_id ( ) ;
768
764
// The `links` key in the manifest dictates that there's only one
769
765
// package in a dependency graph, globally, with that particular
770
766
// `links` key. If this candidate links to something that's already
771
767
// linked to by a different package then we've gotta skip this.
772
- if let Some ( link) = b. summary . links ( ) {
768
+ if let Some ( link) = b. links ( ) {
773
769
if let Some ( & a) = cx. links . get ( & link) {
774
770
if a != b_id {
775
771
conflicting_prev_active
@@ -789,7 +785,7 @@ impl RemainingCandidates {
789
785
// Here we throw out our candidate if it's *compatible*, yet not
790
786
// equal, to all previously activated versions.
791
787
if let Some ( ( a, _) ) = cx. activations . get ( & b_id. as_activations_key ( ) ) {
792
- if * a != b. summary {
788
+ if * a != b {
793
789
conflicting_prev_active
794
790
. entry ( a. package_id ( ) )
795
791
. or_insert ( ConflictReason :: Semver ) ;
@@ -905,7 +901,7 @@ fn generalize_conflicting(
905
901
. find (
906
902
dep,
907
903
& |id| {
908
- if id == other. summary . package_id ( ) {
904
+ if id == other. package_id ( ) {
909
905
// we are imagining that we used other instead
910
906
Some ( backtrack_critical_age)
911
907
} else {
@@ -914,9 +910,9 @@ fn generalize_conflicting(
914
910
age < backtrack_critical_age)
915
911
}
916
912
} ,
917
- Some ( other. summary . package_id ( ) ) ,
913
+ Some ( other. package_id ( ) ) ,
918
914
)
919
- . map ( |con| ( other. summary . package_id ( ) , con) )
915
+ . map ( |con| ( other. package_id ( ) , con) )
920
916
} )
921
917
. collect :: < Option < Vec < ( PackageId , & ConflictMap ) > > > ( )
922
918
{
@@ -973,7 +969,7 @@ fn find_candidate(
973
969
parent : & Summary ,
974
970
backtracked : bool ,
975
971
conflicting_activations : & ConflictMap ,
976
- ) -> Option < ( Candidate , bool , BacktrackFrame ) > {
972
+ ) -> Option < ( Summary , bool , BacktrackFrame ) > {
977
973
// When we're calling this method we know that `parent` failed to
978
974
// activate. That means that some dependency failed to get resolved for
979
975
// whatever reason. Normally, that means that all of those reasons
0 commit comments