Skip to content

Commit d335c9c

Browse files
ehusscamelid
authored andcommitted
instrument-coverage has been stabilized.
1 parent eefbde5 commit d335c9c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/llvm-coverage-instrumentation.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- toc -->
44

55
`rustc` supports detailed source-based code and test coverage analysis
6-
with a command line option (`-Z instrument-coverage`) that instruments Rust
6+
with a command line option (`-C instrument-coverage`) that instruments Rust
77
libraries and binaries with additional instructions and data, at compile time.
88

99
The coverage instrumentation injects calls to the LLVM intrinsic instruction
@@ -28,16 +28,15 @@ them), and generate various reports for analysis, for example:
2828
<br/>
2929

3030
Detailed instructions and examples are documented in the
31-
[Rust Unstable Book (under
32-
_compiler-flags/instrument-coverage_)][unstable-book-instrument-coverage].
31+
[Rustc Book][rustc-book-instrument-coverage].
3332

3433
[llvm-instrprof-increment]: https://llvm.org/docs/LangRef.html#llvm-instrprof-increment-intrinsic
3534
[coverage map]: https://llvm.org/docs/CoverageMappingFormat.html
36-
[unstable-book-instrument-coverage]: https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/instrument-coverage.html
35+
[rustc-book-instrument-coverage]: https://doc.rust-lang.org/nightly/rustc/instrument-coverage.html
3736

3837
## Rust symbol mangling
3938

40-
`-Z instrument-coverage` automatically enables Rust symbol mangling `v0` (as
39+
`-C instrument-coverage` automatically enables Rust symbol mangling `v0` (as
4140
if the user specified `-C symbol-mangling-version=v0` option when invoking
4241
`rustc`) to ensure consistent and reversible name mangling. This has two
4342
important benefits:
@@ -62,7 +61,7 @@ In the `rustc` source tree, `library/profiler_builtins` bundles the LLVM
6261
`profiler_builtins` library is only included when `profiler = true` is set
6362
in `rustc`'s `config.toml`.)
6463

65-
When compiling with `-Z instrument-coverage`,
64+
When compiling with `-C instrument-coverage`,
6665
[`CrateLoader::postprocess()`][crate-loader-postprocess] dynamically loads the
6766
`profiler_builtins` library by calling `inject_profiler_runtime()`.
6867

@@ -287,7 +286,7 @@ instrumented) in the [`coverage`][coverage-test-samples] directory, and the
287286
actual tests and expected results in [`coverage-reports`].
288287

289288
Finally, the [`coverage-llvmir`] test compares compiles a simple Rust program
290-
with `-Z instrument-coverage` and compares the compiled program's LLVM IR to
289+
with `-C instrument-coverage` and compares the compiled program's LLVM IR to
291290
expected LLVM IR instructions and structured data for a coverage-enabled
292291
program, including various checks for Coverage Map-related metadata and the LLVM
293292
intrinsic calls to increment the runtime counters.
@@ -424,7 +423,7 @@ theme in your development environment, you will probably want to use this
424423
option so you can review the graphviz output without straining your vision.
425424

426425
```shell
427-
$ rustc -Z instrument-coverage -Z dump-mir=InstrumentCoverage \
426+
$ rustc -C instrument-coverage -Z dump-mir=InstrumentCoverage \
428427
-Z dump-mir-graphviz some_rust_source.rs
429428
```
430429

@@ -497,7 +496,7 @@ An visual, interactive representation of the final `CoverageSpan`s can be
497496
generated with the following `rustc` flags:
498497

499498
```shell
500-
$ rustc -Z instrument-coverage -Z dump-mir=InstrumentCoverage \
499+
$ rustc -C instrument-coverage -Z dump-mir=InstrumentCoverage \
501500
-Z dump-mir-spanview some_rust_source.rs
502501
```
503502

src/profile-guided-optimization.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ workflow to see how they interact.
4949

5050
[^note-instrument-coverage]: Note: `rustc` now supports front-end-based coverage
5151
instrumentation, via the experimental option
52-
[`-Z instrument-coverage`](./llvm-coverage-instrumentation.md), but using these
52+
[`-C instrument-coverage`](./llvm-coverage-instrumentation.md), but using these
5353
coverage results for PGO has not been attempted at this time.
5454

5555
### Overall Workflow

0 commit comments

Comments
 (0)