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
77libraries and binaries with additional instructions and data, at compile time.
88
99The 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
3030Detailed 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
4140if the user specified ` -C symbol-mangling-version=v0 ` option when invoking
4241` rustc ` ) to ensure consistent and reversible name mangling. This has two
4342important 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
6362in ` 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
287286actual tests and expected results in [ ` coverage-reports ` ] .
288287
289288Finally, 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
291290expected LLVM IR instructions and structured data for a coverage-enabled
292291program, including various checks for Coverage Map-related metadata and the LLVM
293292intrinsic calls to increment the runtime counters.
@@ -424,7 +423,7 @@ theme in your development environment, you will probably want to use this
424423option 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
497496generated 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
0 commit comments