0

Stabilize `-Z instrument-coverage` as `-C instrument-coverage` by joshtriplett ·...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/90132
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Stabilize `-Z instrument-coverage` as `-C instrument-coverage` by joshtriplett · Pull Request #90132 · rust-lang/rust · GitHub

(Tracking issue for instrument-coverage: #79121)

This PR stabilizes support for instrumentation-based code coverage, previously provided via the -Z instrument-coverage option. (Continue supporting -Z instrument-coverage for compatibility for now, but show a deprecation warning for it.)

Many, many people have tested this support, and there are numerous reports of it working as expected.

Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the -C option.

Addressing questions raised in the tracking issue:

If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.)

This stabilization PR updates the option to -C and keeps the -Z variant to ease migration.

The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline?

This stabilization PR depends on #90128 , which stabilizes -C symbol-mangling-version=v0 (but does not change the default symbol-mangling-version).

The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM.

Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement.

The tracking issue and the issue label A-code-coverage link to a few open issues related to instrument-coverage, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization.

The original -Z instrument-coverage support went through a compiler-team MCP at rust-lang/compiler-team#278 . Based on that, @pnkfelix suggested that this needed a stabilization PR and a compiler-team FCP.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK