@@ -958,13 +958,14 @@ fn find_candidate(
958958 } else {
959959 None
960960 } ;
961+ let mut new_frame = None ;
962+ if let Some ( age) = age {
963+ while let Some ( frame) = backtrack_stack. pop ( ) {
964+ // If all members of `conflicting_activations` are still
965+ // active in this back up we know that we're guaranteed to not actually
966+ // make any progress. As a result if we hit this condition we can
967+ // completely skip this backtrack frame and move on to the next.
961968
962- while let Some ( mut frame) = backtrack_stack. pop ( ) {
963- // If all members of `conflicting_activations` are still
964- // active in this back up we know that we're guaranteed to not actually
965- // make any progress. As a result if we hit this condition we can
966- // completely skip this backtrack frame and move on to the next.
967- if let Some ( age) = age {
968969 // Above we use `cx` to determine if this is going to be conflicting.
969970 // But lets just double check if the `pop`ed frame agrees.
970971 let frame_too_new = frame. context . age >= age;
@@ -975,26 +976,30 @@ fn find_candidate(
975976 == frame_too_new. then_some( age)
976977 ) ;
977978
978- if frame_to_new {
979- trace ! (
980- "{} = \" {}\" skip as not solving {}: {:?}" ,
981- frame. dep. package_name( ) ,
982- frame. dep. version_req( ) ,
983- parent. package_id( ) ,
984- conflicting_activations
985- ) ;
986- continue ;
979+ if !frame_too_new {
980+ new_frame = Some ( frame) ;
981+ break ;
987982 }
983+ trace ! (
984+ "{} = \" {}\" skip as not solving {}: {:?}" ,
985+ frame. dep. package_name( ) ,
986+ frame. dep. version_req( ) ,
987+ parent. package_id( ) ,
988+ conflicting_activations
989+ ) ;
988990 }
991+ } else {
992+ // If we're here then we are in abnormal situations and need to just go one frame at a time.
993+ new_frame = backtrack_stack. pop ( ) ;
994+ }
989995
996+ new_frame. map ( |mut frame| {
990997 let ( candidate, has_another) = frame
991998 . remaining_candidates
992999 . next ( & mut frame. conflicting_activations , & frame. context )
9931000 . expect ( "why did we save a frame that has no next?" ) ;
994-
995- return Some ( ( candidate, has_another, frame) ) ;
996- }
997- None
1001+ ( candidate, has_another, frame)
1002+ } )
9981003}
9991004
10001005fn check_cycles ( resolve : & Resolve ) -> CargoResult < ( ) > {
0 commit comments