Add unstable -Zsection-timings flag

This commit is contained in:
Jakub Beránek 2025-08-08 09:34:36 +02:00
parent 045a7977b2
commit 399dff887b
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B
3 changed files with 26 additions and 10 deletions

View File

@ -856,6 +856,7 @@ unstable_cli_options!(
rustdoc_scrape_examples: bool = ("Allows Rustdoc to scrape code examples from reverse-dependencies"), 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"), sbom: bool = ("Enable the `sbom` option in build config in .cargo/config.toml file"),
script: bool = ("Enable support for single-file, `.rs` packages"), script: bool = ("Enable support for single-file, `.rs` packages"),
section_timings: bool = ("Enable support for extended compilation sections in --timings output"),
separate_nightlies: bool, separate_nightlies: bool,
skip_rustdoc_fingerprint: bool, skip_rustdoc_fingerprint: bool,
target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"), 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-map" => self.rustdoc_map = parse_empty(k, v)?,
"rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?, "rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?,
"sbom" => self.sbom = 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)?, "separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?,
"checksum-freshness" => self.checksum_freshness = parse_empty(k, v)?, "checksum-freshness" => self.checksum_freshness = parse_empty(k, v)?,
"skip-rustdoc-fingerprint" => self.skip_rustdoc_fingerprint = parse_empty(k, v)?, "skip-rustdoc-fingerprint" => self.skip_rustdoc_fingerprint = parse_empty(k, v)?,

View File

@ -1938,6 +1938,18 @@ For example:
cargo +nightly fix -Zfix-edition=end=2024,future 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 # Stabilized and removed features
## Compile progress ## Compile progress

View File

@ -1,4 +1,4 @@
<svg width="1255px" height="866px" xmlns="http://www.w3.org/2000/svg"> <svg width="1255px" height="884px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }
@ -92,23 +92,25 @@
</tspan> </tspan>
<tspan x="10px" y="694px"><tspan> -Z script Enable support for single-file, `.rs` packages</tspan> <tspan x="10px" y="694px"><tspan> -Z script Enable support for single-file, `.rs` packages</tspan>
</tspan> </tspan>
<tspan x="10px" y="712px"><tspan> -Z target-applies-to-host Enable the `target-applies-to-host` key in the .cargo/config.toml file</tspan> <tspan x="10px" y="712px"><tspan> -Z section-timings Enable support for extended compilation sections in --timings output</tspan>
</tspan> </tspan>
<tspan x="10px" y="730px"><tspan> -Z trim-paths Enable the `trim-paths` option in profiles</tspan> <tspan x="10px" y="730px"><tspan> -Z target-applies-to-host Enable the `target-applies-to-host` key in the .cargo/config.toml file</tspan>
</tspan> </tspan>
<tspan x="10px" y="748px"><tspan> -Z unstable-options Allow the usage of unstable options</tspan> <tspan x="10px" y="748px"><tspan> -Z trim-paths Enable the `trim-paths` option in profiles</tspan>
</tspan> </tspan>
<tspan x="10px" y="766px"><tspan> -Z warnings Allow use of the build.warnings config key</tspan> <tspan x="10px" y="766px"><tspan> -Z unstable-options Allow the usage of unstable options</tspan>
</tspan> </tspan>
<tspan x="10px" y="784px"> <tspan x="10px" y="784px"><tspan> -Z warnings Allow use of the build.warnings config key</tspan>
</tspan> </tspan>
<tspan x="10px" y="802px"><tspan>Run with `cargo -Z [FLAG] [COMMAND]`</tspan> <tspan x="10px" y="802px">
</tspan> </tspan>
<tspan x="10px" y="820px"> <tspan x="10px" y="820px"><tspan>Run with `cargo -Z [FLAG] [COMMAND]`</tspan>
</tspan> </tspan>
<tspan x="10px" y="838px"><tspan>See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.</tspan> <tspan x="10px" y="838px">
</tspan> </tspan>
<tspan x="10px" y="856px"> <tspan x="10px" y="856px"><tspan>See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.</tspan>
</tspan>
<tspan x="10px" y="874px">
</tspan> </tspan>
</text> </text>

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB