rust/tests/ui/instrument-coverage
Matthias Krüger 7667a91778
Rollup merge of #125756 - Zalathar:branch-on-bool, r=oli-obk
coverage: Optionally instrument the RHS of lazy logical operators

(This is an updated version of #124644 and #124402. Fixes #124120.)

When `||` or `&&` is used outside of a branching context (such as the condition of an `if`), the rightmost value does not directly influence any branching decision, so branch coverage instrumentation does not treat it as its own true-or-false branch.

That is a correct and useful interpretation of “branch coverage”, but might be undesirable in some contexts, as described at #124120. This PR therefore adds a new coverage level `-Zcoverage-options=condition` that behaves like branch coverage, but also adds additional branch instrumentation to the right-hand-side of lazy boolean operators.

---

As discussed at https://github.com/rust-lang/rust/issues/124120#issuecomment-2092394586, this is mainly intended as an intermediate step towards fully-featured MC/DC instrumentation. It's likely that we'll eventually want to remove this coverage level (rather than stabilize it), either because it has been incorporated into MC/DC instrumentation, or because it's getting in the way of future MC/DC work. The main appeal of landing it now is so that work on tracking conditions can proceed concurrently with other MC/DC-related work.

````@rustbot```` label +A-code-coverage
2024-05-31 17:05:24 +02:00
..
bad-value.bad.stderr coverage: Remove all unstable values of -Cinstrument-coverage 2024-03-13 11:14:09 +11:00
bad-value.blank.stderr coverage: Remove all unstable values of -Cinstrument-coverage 2024-03-13 11:14:09 +11:00
bad-value.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coverage-options.bad.stderr coverage: Add CLI support for -Zcoverage-options=condition 2024-05-30 15:38:46 +10:00
coverage-options.rs coverage: Add CLI support for -Zcoverage-options=condition 2024-05-30 15:38:46 +10:00
mcdc-condition-limit.bad.stderr coverage: Rename MC/DC conditions_num to num_conditions 2024-05-30 13:16:07 +10:00
mcdc-condition-limit.rs coverage: Rename MC/DC conditions_num to num_conditions 2024-05-30 13:16:07 +10:00
off-values.rs Rename invalid false cfg to valid _false cfg 2024-04-07 01:16:46 +02:00
on-values.rs tests/ui: prepare some tests for --check-cfg by default 2024-05-04 11:30:38 +02:00