Skip to content

Commit 6ce9087

Browse files
committed
Bring back the compile progress bar as an -Z option.
1 parent 15e6361 commit 6ce9087

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Available unstable (nightly-only) flags:
2222
-Z offline -- Offline mode that does not perform network requests
2323
-Z unstable-options -- Allow the usage of unstable options such as --registry
2424
-Z config-profile -- Read profiles from .cargo/config files
25+
-Z compile-progress -- Display a progress bar while compiling
2526
2627
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
2728
);

src/cargo/core/compiler/job_queue.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ impl<'a> JobQueue<'a> {
195195
// we're at it.
196196
let mut error = None;
197197
let mut progress = Progress::with_style("Building", ProgressStyle::Ratio, cx.bcx.config);
198-
progress.disable();
198+
if !cx.bcx.config.cli_unstable().compile_progress {
199+
progress.disable();
200+
}
199201
let total = self.queue.len();
200202
loop {
201203
// Dequeue as much work as we can, learning about everything

src/cargo/core/features.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ pub struct CliUnstable {
311311
pub package_features: bool,
312312
pub advanced_env: bool,
313313
pub config_profile: bool,
314+
pub compile_progress: bool,
314315
}
315316

316317
impl CliUnstable {
@@ -347,6 +348,7 @@ impl CliUnstable {
347348
"package-features" => self.package_features = true,
348349
"advanced-env" => self.advanced_env = true,
349350
"config-profile" => self.config_profile = true,
351+
"compile-progress" => self.compile_progress = true,
350352
_ => bail!("unknown `-Z` flag specified: {}", k),
351353
}
352354

src/doc/src/reference/unstable.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,19 @@ Example:
292292
```
293293
cargo +nightly build --build-plan -Z unstable-options
294294
```
295+
296+
### Compile progress
297+
* Tracking Issue: [rust-lang/cargo#2536](https://github.com/rust-lang/cargo/issues/2536)
298+
299+
The `-Z compile-progress` flag enables a progress bar while compiling.
300+
301+
```console
302+
$ cargo +nightly build -Z compile-progress
303+
Compiling libc v0.2.41
304+
Compiling void v1.0.2
305+
Compiling lazy_static v1.0.1
306+
Compiling regex v1.0.0
307+
Compiling ucd-util v0.1.1
308+
Compiling utf8-ranges v1.0.0
309+
Building [=======> ] 2/14: libc, regex, uc...
310+
```

0 commit comments

Comments
 (0)