@@ -137,7 +137,7 @@ pub fn resolve(
137
137
let cx = activate_deps_loop ( cx, & mut registry, summaries, config) ?;
138
138
139
139
let mut cksums = HashMap :: new ( ) ;
140
- for summary in cx. activations . values ( ) . flat_map ( |v| v . iter ( ) ) {
140
+ for summary in cx. activations . values ( ) {
141
141
let cksum = summary. checksum ( ) . map ( |s| s. to_string ( ) ) ;
142
142
cksums. insert ( summary. package_id ( ) , cksum) ;
143
143
}
@@ -237,13 +237,6 @@ fn activate_deps_loop(
237
237
dep. package_name( ) ,
238
238
candidates. len( )
239
239
) ;
240
- trace ! (
241
- "{}[{}]>{} {} prev activations" ,
242
- parent. name( ) ,
243
- cur,
244
- dep. package_name( ) ,
245
- cx. prev_active( & dep) . len( )
246
- ) ;
247
240
248
241
let just_here_for_the_error_messages = just_here_for_the_error_messages
249
242
&& past_conflicting_activations
@@ -759,16 +752,15 @@ impl RemainingCandidates {
759
752
dep : & Dependency ,
760
753
parent : PackageId ,
761
754
) -> Option < ( Candidate , bool ) > {
762
- let prev_active = cx. prev_active ( dep) ;
763
-
764
755
' main: for ( _, b) in self . remaining . by_ref ( ) {
756
+ let b_id = b. summary . package_id ( ) ;
765
757
// The `links` key in the manifest dictates that there's only one
766
758
// package in a dependency graph, globally, with that particular
767
759
// `links` key. If this candidate links to something that's already
768
760
// linked to by a different package then we've gotta skip this.
769
761
if let Some ( link) = b. summary . links ( ) {
770
762
if let Some ( & a) = cx. links . get ( & link) {
771
- if a != b . summary . package_id ( ) {
763
+ if a != b_id {
772
764
conflicting_prev_active
773
765
. entry ( a)
774
766
. or_insert_with ( || ConflictReason :: Links ( link) ) ;
@@ -785,10 +777,7 @@ impl RemainingCandidates {
785
777
//
786
778
// Here we throw out our candidate if it's *compatible*, yet not
787
779
// equal, to all previously activated versions.
788
- if let Some ( a) = prev_active
789
- . iter ( )
790
- . find ( |a| compatible ( a. version ( ) , b. summary . version ( ) ) )
791
- {
780
+ if let Some ( a) = cx. activations . get ( & b_id. as_activations_key ( ) ) {
792
781
if * a != b. summary {
793
782
conflicting_prev_active
794
783
. entry ( a. package_id ( ) )
@@ -803,11 +792,11 @@ impl RemainingCandidates {
803
792
// all of witch also need to be checked the same way.
804
793
if let Some ( public_dependency) = cx. public_dependency . as_ref ( ) {
805
794
let existing_public_deps: Vec < PackageId > = public_dependency
806
- . get ( & b . summary . package_id ( ) )
795
+ . get ( & b_id )
807
796
. iter ( )
808
797
. flat_map ( |x| x. values ( ) )
809
798
. filter_map ( |x| if x. 1 { Some ( & x. 0 ) } else { None } )
810
- . chain ( & Some ( b . summary . package_id ( ) ) )
799
+ . chain ( & Some ( b_id ) )
811
800
. cloned ( )
812
801
. collect ( ) ;
813
802
for t in existing_public_deps {
@@ -851,27 +840,6 @@ impl RemainingCandidates {
851
840
}
852
841
}
853
842
854
- // Returns if `a` and `b` are compatible in the semver sense. This is a
855
- // commutative operation.
856
- //
857
- // Versions `a` and `b` are compatible if their left-most nonzero digit is the
858
- // same.
859
- fn compatible ( a : & semver:: Version , b : & semver:: Version ) -> bool {
860
- if a. major != b. major {
861
- return false ;
862
- }
863
- if a. major != 0 {
864
- return true ;
865
- }
866
- if a. minor != b. minor {
867
- return false ;
868
- }
869
- if a. minor != 0 {
870
- return true ;
871
- }
872
- a. patch == b. patch
873
- }
874
-
875
843
/// Looks through the states in `backtrack_stack` for dependencies with
876
844
/// remaining candidates. For each one, also checks if rolling back
877
845
/// could change the outcome of the failed resolution that caused backtracking
@@ -937,11 +905,8 @@ fn find_candidate(
937
905
}
938
906
939
907
fn check_cycles ( resolve : & Resolve , activations : & Activations ) -> CargoResult < ( ) > {
940
- let summaries: HashMap < PackageId , & Summary > = activations
941
- . values ( )
942
- . flat_map ( |v| v. iter ( ) )
943
- . map ( |s| ( s. package_id ( ) , s) )
944
- . collect ( ) ;
908
+ let summaries: HashMap < PackageId , & Summary > =
909
+ activations. values ( ) . map ( |s| ( s. package_id ( ) , s) ) . collect ( ) ;
945
910
946
911
// Sort packages to produce user friendly deterministic errors.
947
912
let mut all_packages: Vec < _ > = resolve. iter ( ) . collect ( ) ;
0 commit comments