From 399dff887b09c21aba9b766a193d6cebce3d5f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 8 Aug 2025 09:34:36 +0200 Subject: [PATCH 1/6] Add unstable `-Zsection-timings` flag --- src/cargo/core/features.rs | 2 ++ src/doc/src/reference/unstable.md | 12 +++++++++++ tests/testsuite/cargo/z_help/stdout.term.svg | 22 +++++++++++--------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/cargo/core/features.rs b/src/cargo/core/features.rs index 5c13b1a6e41..60e2ebbdb4c 100644 --- a/src/cargo/core/features.rs +++ b/src/cargo/core/features.rs @@ -856,6 +856,7 @@ unstable_cli_options!( rustdoc_scrape_examples: bool = ("Allows Rustdoc to scrape code examples from reverse-dependencies"), sbom: bool = ("Enable the `sbom` option in build config in .cargo/config.toml file"), script: bool = ("Enable support for single-file, `.rs` packages"), + section_timings: bool = ("Enable support for extended compilation sections in --timings output"), separate_nightlies: bool, skip_rustdoc_fingerprint: bool, target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"), @@ -1380,6 +1381,7 @@ impl CliUnstable { "rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?, "rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?, "sbom" => self.sbom = parse_empty(k, v)?, + "section-timings" => self.section_timings = parse_empty(k, v)?, "separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?, "checksum-freshness" => self.checksum_freshness = parse_empty(k, v)?, "skip-rustdoc-fingerprint" => self.skip_rustdoc_fingerprint = parse_empty(k, v)?, diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index e267f63f833..ffae6b5d85e 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -1938,6 +1938,18 @@ For example: cargo +nightly fix -Zfix-edition=end=2024,future ``` +## section-timings +* Original Pull Request: [#15780](https://github.com/rust-lang/cargo/pull/15780) +* Tracking Issue: [#15817](https://github.com/rust-lang/cargo/issues/15817) + +This feature can be used to extend the output of `cargo build --timings`. It will tell rustc +to produce timings of individual compilation sections, which will be then displayed in the timings +HTML/JSON output. + +```console +cargo +nightly -Zsection-timings build --timings +``` + # Stabilized and removed features ## Compile progress diff --git a/tests/testsuite/cargo/z_help/stdout.term.svg b/tests/testsuite/cargo/z_help/stdout.term.svg index 8f424558d19..23edf8d5096 100644 --- a/tests/testsuite/cargo/z_help/stdout.term.svg +++ b/tests/testsuite/cargo/z_help/stdout.term.svg @@ -1,4 +1,4 @@ - +