Skip to content

Commit 2cce8b4

Browse files
committed
deduplicate the check
1 parent 0716b88 commit 2cce8b4

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/cargo/core/resolver/mod.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -965,30 +965,25 @@ fn find_candidate(
965965
// make any progress. As a result if we hit this condition we can
966966
// completely skip this backtrack frame and move on to the next.
967967
if let Some(age) = age {
968-
if frame.context.age >= age {
968+
// Above we use `cx` to determine if this is going to be conflicting.
969+
// But lets just double check if the `pop`ed frame agrees.
970+
let frame_to_new = frame.context.age >= age;
971+
debug_assert!(
972+
frame
973+
.context
974+
.is_conflicting(Some(parent.package_id()), conflicting_activations)
975+
== frame_to_new.then_some(age)
976+
);
977+
978+
if frame_to_new {
969979
trace!(
970980
"{} = \"{}\" skip as not solving {}: {:?}",
971981
frame.dep.package_name(),
972982
frame.dep.version_req(),
973983
parent.package_id(),
974984
conflicting_activations
975985
);
976-
// above we use `cx` to determine that this is still going to be conflicting.
977-
// but lets just double check.
978-
debug_assert!(
979-
frame
980-
.context
981-
.is_conflicting(Some(parent.package_id()), conflicting_activations)
982-
== Some(age)
983-
);
984986
continue;
985-
} else {
986-
// above we use `cx` to determine that this is not going to be conflicting.
987-
// but lets just double check.
988-
debug_assert!(frame
989-
.context
990-
.is_conflicting(Some(parent.package_id()), conflicting_activations)
991-
.is_none());
992987
}
993988
}
994989

0 commit comments

Comments
 (0)