From: Eh2406 Date: Sat, 17 Mar 2018 14:07:13 +0000 (-0400) Subject: When activating for the better error messages don't waste time on the other backtrack... X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~31^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c771a4c6b0e24523552fc0db3e8c584957c5ada4;p=cargo.git When activating for the better error messages don't waste time on the other backtrack frames --- diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index 13054aa4f..90042e0b2 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -1097,18 +1097,34 @@ fn activate_deps_loop( has_past_conflicting_dep = true; } } - // 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 && (just_here_for_the_error_messages || { + let activate_for_error_message = has_past_conflicting_dep && !has_another && { + // has_past_conflicting_dep -> One of this candidate deps will fail. + // !has_another -> If the candidate is not accepted we will backtrack. + + // So the question is will the user see that we skipped this candidate? + just_here_for_the_error_messages || { + // make sure we know about all the possible conflicts conflicting_activations .extend(remaining_candidates.conflicting_prev_active.clone()); + // test if backtracking will get to the user find_candidate( &mut backtrack_stack.clone(), &parent, &conflicting_activations, ).is_none() - })) { + } + }; + if activate_for_error_message { + // We know one of this candidate deps will fail, + // which means we will fail, + // and that none of the backtrack frames will + // find a candidate that will help. + // So lets clean up the useless backtrack frames. + backtrack_stack.clear(); + } + // 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 || activate_for_error_message { remaining_deps.push(frame); } else { trace!(