Skip to content

Commit dcd7c48

Browse files
committed
Keep better track of finished crates
Instead of juggling a few counters let's just keep an explicit counter of finished packages.
1 parent 7892472 commit dcd7c48

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/cargo/core/compiler/job_queue.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
283283
// and then immediately return.
284284
let mut error = None;
285285
let total = self.queue.len();
286+
let mut finished = 0;
286287
loop {
287288
// Dequeue as much work as we can, learning about everything
288289
// possible that can run. Note that this is also the point where we
@@ -320,7 +321,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
320321
// unnecessarily.
321322
let events: Vec<_> = self.rx.try_iter().collect();
322323
let events = if events.is_empty() {
323-
self.show_progress(total);
324+
self.show_progress(finished, total);
324325
vec![self.rx.recv().unwrap()]
325326
} else {
326327
events
@@ -355,6 +356,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
355356
// from the `active` map ...
356357
Artifact::All => {
357358
info!("end: {:?}", id);
359+
finished += 1;
358360
self.active.remove(&id).unwrap()
359361
}
360362
// ... otherwise if it hasn't finished we leave it
@@ -431,8 +433,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
431433
}
432434
}
433435

434-
fn show_progress(&mut self, total: usize) {
435-
let count = total - self.queue.len() - self.active.len();
436+
fn show_progress(&mut self, count: usize, total: usize) {
436437
let active_names = self
437438
.active
438439
.values()

0 commit comments

Comments
 (0)