diff options
| author | bors <bors@rust-lang.org> | 2024-04-30 02:47:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-30 02:47:25 +0000 |
| commit | f9dca46218d4b8efa062aec4fd0820cbb4942aa2 (patch) | |
| tree | d618e09805a64c32ebc8868c917dd9ae9f746f29 /src/doc | |
| parent | 74a8df6c650f6067babf942a77f78e9b9a7fee31 (diff) | |
| parent | f9263374fb8143c7fa1850a43759249a73415cdf (diff) | |
| download | rust-f9dca46218d4b8efa062aec4fd0820cbb4942aa2.tar.gz rust-f9dca46218d4b8efa062aec4fd0820cbb4942aa2.zip | |
Auto merge of #124507 - Zalathar:coverage-level, r=compiler-errors
coverage: Replace boolean options with a `CoverageLevel` enum After #123409, and some discussion at https://github.com/rust-lang/rust/issues/79649#issuecomment-2042093553 and #124120, it became clear to me that we should have a unified concept of “coverage level”, instead of having several separate boolean flags that aren't actually independent. This PR therefore introduces a `CoverageLevel` enum, to replace the existing boolean flags for `branch` and `mcdc`. The `no-branch` value (for `-Zcoverage-options`) has been renamed to `block`, instructing the compiler to only instrument for block coverage, with no branch coverage or MD/DC instrumentation. `@rustbot` label +A-code-coverage cc `@ZhuUx` `@Lambdaris` `@RenjiSann`
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc/src/instrument-coverage.md | 6 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/coverage-options.md | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/doc/rustc/src/instrument-coverage.md b/src/doc/rustc/src/instrument-coverage.md index bbd81e7437c..32dc992c42f 100644 --- a/src/doc/rustc/src/instrument-coverage.md +++ b/src/doc/rustc/src/instrument-coverage.md @@ -348,11 +348,7 @@ $ llvm-cov report \ ## `-Z coverage-options=<options>` -This unstable option provides finer control over some aspects of coverage -instrumentation. Pass one or more of the following values, separated by commas. - -- Either `no-branch`, `branch` or `mcdc` - - `branch` enables branch coverage instrumentation and `mcdc` further enables modified condition/decision coverage instrumentation. `no-branch` disables branch coverage instrumentation, which is same as do not pass `branch` or `mcdc`. +[This unstable option is described in the Unstable Book.](../unstable-book/compiler-flags/coverage-options.html) ## Other references diff --git a/src/doc/unstable-book/src/compiler-flags/coverage-options.md b/src/doc/unstable-book/src/compiler-flags/coverage-options.md index 5e192d9aca1..21278833550 100644 --- a/src/doc/unstable-book/src/compiler-flags/coverage-options.md +++ b/src/doc/unstable-book/src/compiler-flags/coverage-options.md @@ -5,4 +5,13 @@ This option controls details of the coverage instrumentation performed by Multiple options can be passed, separated by commas. Valid options are: -- `no-branch`, `branch` or `mcdc`: `branch` enables branch coverage instrumentation and `mcdc` further enables modified condition/decision coverage instrumentation. `no-branch` disables branch coverage instrumentation as well as mcdc instrumentation, which is same as do not pass `branch` or `mcdc`. +- `block`, `branch`, `mcdc`: + Sets the level of coverage instrumentation. + Setting the level will override any previously-specified level. + - `block` (default): + Blocks in the control-flow graph will be instrumented for coverage. + - `branch`: + In addition to block coverage, also enables branch coverage instrumentation. + - `mcdc`: + In addition to block and branch coverage, also enables MC/DC instrumentation. + (Branch coverage instrumentation may differ in some cases.) |
