Skip to content

Commit c840003

Browse files
committed
Update instrument-coverage documentation to document stability and LLVM versions
The instrument-coverage option is stable; the details of the profile data format are not. Recommend llvm-tools-preview as the preferred alternative to obtain a compatible version of the LLVM tools, rather than finding LLVM tools elsewhere.
1 parent 760c13f commit c840003

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/doc/rustc/src/codegen-options/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ The default depends on the [opt-level](#opt-level):
182182
This option enables instrumentation-based code coverage support. See the
183183
chapter on [instrumentation-based code coverage] for more information.
184184

185+
Note that while the `-C instrument-coverage` option is stable, the profile data
186+
format produced by the resulting instrumentation may change, and may not work
187+
with coverage tools other than those built and shipped with the compiler.
188+
185189
## link-arg
186190

187191
This flag lets you append a single extra argument to the linker invocation.

src/doc/rustc/src/instrument-coverage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ If `LLVM_PROFILE_FILE` contains a path to a non-existent directory, the missing
117117

118118
## Installing LLVM coverage tools
119119

120-
LLVM's supplies two tools—`llvm-profdata` and `llvm-cov`—that process coverage data and generate reports. There are several ways to find and/or install these tools, but note that the coverage mapping data generated by the Rust compiler requires LLVM version 12 or higher. (`llvm-cov --version` typically shows the tool's LLVM version number.):
120+
LLVM's supplies two tools—`llvm-profdata` and `llvm-cov`—that process coverage data and generate reports. There are several ways to find and/or install these tools, but note that the coverage mapping data generated by the Rust compiler requires LLVM version 12 or higher, and processing the *raw* data may require exactly the LLVM version used by the compiler. (`llvm-cov --version` typically shows the tool's LLVM version number, and `rustc --verbose --version` shows the version of LLVM used by the Rust compiler.)
121121

122-
- You can install the LLVM tools from your operating system distribution, or from your distribution of LLVM.
122+
- You can install compatible versions of these tools via the `rustup` component `llvm-tools-preview`. This component is the recommended path, though it's still considered experimental. In this case, you may also find `cargo-binutils` useful as a wrapper around these tools.
123+
- You can install a compatible version of LLVM tools from your operating system distribution, or from your distribution of LLVM.
123124
- If you are building the Rust compiler from source, you can optionally use the bundled LLVM tools, built from source. Those tool binaries can typically be found in your build platform directory at something like: `rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-*`.
124-
- You can install compatible versions of these tools via the `rustup` component `llvm-tools-preview`, though this is still considered experimental. In this case, you may also find `cargo-binutils` useful as a wrapper around these tools.
125125

126126
The examples in this document show how to use the llvm tools directly.
127127

0 commit comments

Comments
 (0)