Skip to content

Commit 8f76fde

Browse files
committed
Auto merge of #5104 - Eh2406:bug_fix, r=alexcrichton
missed this important bug In the PR #5000 I finished and we merged yesterday I missed a bug and left in an outdated comment. @alexcrichton
2 parents 558c7d2 + d9c97de commit 8f76fde

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/cargo/core/resolver/mod.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,6 @@ fn activate_deps_loop<'a>(
778778
&mut remaining_candidates,
779779
&mut conflicting_activations,
780780
).ok_or_else(|| {
781-
// if we hit an activation error and we are out of other combinations
782-
// then just report that error
783781
activation_error(
784782
&cx,
785783
registry,
@@ -827,8 +825,13 @@ fn activate_deps_loop<'a>(
827825

828826
// Add an entry to the `backtrack_stack` so
829827
// we can try the next one if this one fails.
830-
if has_another && successfully_activated {
831-
backtrack_stack.push(backtrack);
828+
if successfully_activated {
829+
if has_another {
830+
backtrack_stack.push(backtrack);
831+
}
832+
} else {
833+
// `activate` changed `cx` and then failed so put things back.
834+
cx = backtrack.context_backup;
832835
}
833836
}
834837
}

tests/testsuite/generate_lockfile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn no_index_update() {
8888
.build();
8989

9090
assert_that(p.cargo("generate-lockfile"),
91-
execs().with_status(0).with_stdout("")
91+
execs().with_stdout("")
9292
.with_stderr_contains(" Updating registry `https://github.com/rust-lang/crates.io-index`"));
9393

9494
assert_that(p.cargo("generate-lockfile").masquerade_as_nightly_cargo().arg("-Zno-index-update"),

0 commit comments

Comments
 (0)