Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/cargo/core/compiler/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ pub struct JobQueue<'a, 'cfg> {
/// It is created from JobQueue when we have fully assembled the crate graph
/// (i.e., all package dependencies are known).
struct DrainState<'a, 'cfg> {
// This is the length of the DependencyQueue when starting out
total_units: usize,

queue: DependencyQueue<Unit<'a>, Artifact, Job>,
tx: Sender<Message>,
rx: Receiver<Message>,
Expand Down Expand Up @@ -341,6 +344,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
let (tx, rx) = channel();
let progress = Progress::with_style("Building", ProgressStyle::Ratio, cx.bcx.config);
let state = DrainState {
total_units: self.queue.len(),
queue: self.queue,
tx,
rx,
Expand Down Expand Up @@ -713,7 +717,7 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
.collect::<Vec<_>>();
drop(self.progress.tick_now(
self.finished,
self.queue.len(),
self.total_units,
&format!(": {}", active_names.join(", ")),
));
}
Expand Down
1 change: 1 addition & 0 deletions src/cargo/util/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ impl<'cfg> State<'cfg> {

impl Format {
fn progress(&self, cur: usize, max: usize) -> Option<String> {
assert!(cur <= max);
// Render the percentage at the far right and then figure how long the
// progress bar is
let pct = (cur as f64) / (max as f64);
Expand Down