You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #124507 - Zalathar:coverage-level, r=compiler-errors
coverage: Replace boolean options with a `CoverageLevel` enum
After #123409, and some discussion at #79649 (comment) 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`
pubconst parse_instrument_xray:&str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`";
399
399
pubconst parse_unpretty:&str = "`string` or `string=string`";
400
400
pubconst parse_treat_err_as_bug:&str = "either no value or a non-negative number";
Copy file name to clipboardexpand all lines: src/doc/rustc/src/instrument-coverage.md
+1-5
Original file line number
Diff line number
Diff line change
@@ -348,11 +348,7 @@ $ llvm-cov report \
348
348
349
349
## `-Z coverage-options=<options>`
350
350
351
-
This unstable option provides finer control over some aspects of coverage
352
-
instrumentation. Pass one or more of the following values, separated by commas.
353
-
354
-
- Either `no-branch`, `branch` or `mcdc`
355
-
-`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`.
351
+
[This unstable option is described in the Unstable Book.](../unstable-book/compiler-flags/coverage-options.html)
Copy file name to clipboardexpand all lines: src/doc/unstable-book/src/compiler-flags/coverage-options.md
+10-1
Original file line number
Diff line number
Diff line change
@@ -5,4 +5,13 @@ This option controls details of the coverage instrumentation performed by
5
5
6
6
Multiple options can be passed, separated by commas. Valid options are:
7
7
8
-
-`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`.
8
+
-`block`, `branch`, `mcdc`:
9
+
Sets the level of coverage instrumentation.
10
+
Setting the level will override any previously-specified level.
11
+
-`block` (default):
12
+
Blocks in the control-flow graph will be instrumented for coverage.
13
+
-`branch`:
14
+
In addition to block coverage, also enables branch coverage instrumentation.
15
+
-`mcdc`:
16
+
In addition to block and branch coverage, also enables MC/DC instrumentation.
17
+
(Branch coverage instrumentation may differ in some cases.)
0 commit comments