Only activate for the better error messages if we will bactrack to the user
authorEh2406 <YeomanYaacov@gmail.com>
Tue, 13 Mar 2018 15:54:21 +0000 (11:54 -0400)
committerEh2406 <YeomanYaacov@gmail.com>
Tue, 13 Mar 2018 16:39:54 +0000 (12:39 -0400)
src/cargo/core/resolver/mod.rs

index 06addad85d40df8d0d8d3ec61d6bf5d77200b1fe..76fd86ae6b9691852be71c8541f8ad313d3fcc5e 100644 (file)
@@ -899,10 +899,12 @@ fn activate_deps_loop(
                 // to activate that one.
                 trace!("{}[{}]>{} -- no candidates", parent.name(), cur, dep.name());
 
-                let past = past_conflicting_activations.entry(dep.clone()).or_insert_with(Vec::new);
-                if !just_here_for_the_error_messages && !past.contains(&conflicting_activations) {
-                    trace!("{}[{}]>{} adding a skip {:?}", parent.name(), cur, dep.name(), conflicting_activations);
-                    past.push(conflicting_activations.clone());
+                if !just_here_for_the_error_messages && !backtracked {
+                    let past = past_conflicting_activations.entry(dep.clone()).or_insert_with(Vec::new);
+                    if !past.contains(&conflicting_activations) {
+                        trace!("{}[{}]>{} adding a skip {:?}", parent.name(), cur, dep.name(), conflicting_activations);
+                        past.push(conflicting_activations.clone());
+                    }
                 }
 
                 find_candidate(
@@ -997,11 +999,15 @@ fn activate_deps_loop(
                     }
                     // if not has_another we we activate for the better error messages
                     frame.just_for_error_messages = has_past_conflicting_dep;
-                    if has_past_conflicting_dep && has_another {
+                    if !has_past_conflicting_dep || (!has_another && (just_here_for_the_error_messages || find_candidate(
+                        &mut backtrack_stack.clone(),
+                        &parent,
+                        &conflicting_activations,
+                    ).is_none())) {
+                        remaining_deps.push(frame);
+                    } else {
                         trace!("{}[{}]>{} skipping {} ", parent.name(), cur, dep.name(), pid.version());
                         successfully_activated = false;
-                    } else {
-                        remaining_deps.push(frame);
                     }
                     deps_time += dur;
                 }