Skip to content

Commit 1a1ba80

Browse files
committed
cur is not as helpful as age when debugging
1 parent a3ea135 commit 1a1ba80

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/cargo/core/resolver/mod.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ fn activate_deps_loop(
208208
while let Some((just_here_for_the_error_messages, frame)) =
209209
remaining_deps.pop_most_constrained()
210210
{
211-
let (mut parent, (mut cur, (mut dep, candidates, mut features))) = frame;
211+
let (mut parent, (mut dep, candidates, mut features)) = frame;
212212

213213
// If we spend a lot of time here (we shouldn't in most cases) then give
214214
// a bit of a visual indicator as to what we're doing.
@@ -217,7 +217,7 @@ fn activate_deps_loop(
217217
trace!(
218218
"{}[{}]>{} {} candidates",
219219
parent.name(),
220-
cur,
220+
cx.age(),
221221
dep.package_name(),
222222
candidates.len()
223223
);
@@ -263,7 +263,7 @@ fn activate_deps_loop(
263263
trace!(
264264
"{}[{}]>{} -- no candidates",
265265
parent.name(),
266-
cur,
266+
cx.age(),
267267
dep.package_name()
268268
);
269269

@@ -308,7 +308,6 @@ fn activate_deps_loop(
308308
Some((candidate, has_another, frame)) => {
309309
// Reset all of our local variables used with the
310310
// contents of `frame` to complete our backtrack.
311-
cur = frame.cur;
312311
cx = frame.context;
313312
remaining_deps = frame.remaining_deps;
314313
remaining_candidates = frame.remaining_candidates;
@@ -353,7 +352,6 @@ fn activate_deps_loop(
353352
// if we can.
354353
let backtrack = if has_another {
355354
Some(BacktrackFrame {
356-
cur,
357355
context: Context::clone(&cx),
358356
remaining_deps: remaining_deps.clone(),
359357
remaining_candidates: remaining_candidates.clone(),
@@ -376,7 +374,7 @@ fn activate_deps_loop(
376374
trace!(
377375
"{}[{}]>{} trying {}",
378376
parent.name(),
379-
cur,
377+
cx.age(),
380378
dep.package_name(),
381379
candidate.version()
382380
);
@@ -409,7 +407,7 @@ fn activate_deps_loop(
409407
if let Some(conflicting) = frame
410408
.remaining_siblings
411409
.clone()
412-
.filter_map(|(_, (ref new_dep, _, _))| {
410+
.filter_map(|(ref new_dep, _, _)| {
413411
past_conflicting_activations.conflicting(&cx, new_dep)
414412
})
415413
.next()
@@ -526,7 +524,7 @@ fn activate_deps_loop(
526524
trace!(
527525
"{}[{}]>{} skipping {} ",
528526
parent.name(),
529-
cur,
527+
cx.age(),
530528
dep.package_name(),
531529
pid.version()
532530
);
@@ -700,7 +698,6 @@ fn activate(
700698

701699
#[derive(Clone)]
702700
struct BacktrackFrame {
703-
cur: usize,
704701
context: Context,
705702
remaining_deps: RemainingDeps,
706703
remaining_candidates: RemainingCandidates,
@@ -759,7 +756,7 @@ impl RemainingCandidates {
759756
dep: &Dependency,
760757
parent: PackageId,
761758
) -> Option<(Summary, bool)> {
762-
'main: for (_, b) in self.remaining.by_ref() {
759+
'main: for b in self.remaining.by_ref() {
763760
let b_id = b.package_id();
764761
// The `links` key in the manifest dictates that there's only one
765762
// package in a dependency graph, globally, with that particular

src/cargo/core/resolver/types.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl DepsFrame {
146146
pub fn flatten<'a>(&'a self) -> impl Iterator<Item = (PackageId, Dependency)> + 'a {
147147
self.remaining_siblings
148148
.clone()
149-
.map(move |(_, (d, _, _))| (self.parent.package_id(), d))
149+
.map(move |(d, _, _)| (self.parent.package_id(), d))
150150
}
151151
}
152152

@@ -202,7 +202,7 @@ impl RemainingDeps {
202202
self.data.insert((x, insertion_time));
203203
self.time += 1;
204204
}
205-
pub fn pop_most_constrained(&mut self) -> Option<(bool, (Summary, (usize, DepInfo)))> {
205+
pub fn pop_most_constrained(&mut self) -> Option<(bool, (Summary, DepInfo))> {
206206
while let Some((mut deps_frame, insertion_time)) = self.data.remove_min() {
207207
let just_here_for_the_error_messages = deps_frame.just_for_error_messages;
208208

@@ -325,12 +325,10 @@ impl<T> Iterator for RcVecIter<T>
325325
where
326326
T: Clone,
327327
{
328-
type Item = (usize, T);
328+
type Item = T;
329329

330330
fn next(&mut self) -> Option<Self::Item> {
331-
self.rest
332-
.next()
333-
.and_then(|i| self.vec.get(i).map(|val| (i, val.clone())))
331+
self.rest.next().and_then(|i| self.vec.get(i).cloned())
334332
}
335333

336334
fn size_hint(&self) -> (usize, Option<usize>) {

0 commit comments

Comments
 (0)