coverage: Add a synthetic test for when all spans are discarded

This commit is contained in:
Zalathar 2024-12-19 21:53:10 +11:00
parent 837a25dd41
commit aced4dcf10
8 changed files with 67 additions and 3 deletions

View file

@ -147,18 +147,24 @@ pub enum InstrumentCoverage {
Yes,
}
/// Individual flag values controlled by `-Z coverage-options`.
/// Individual flag values controlled by `-Zcoverage-options`.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Default)]
pub struct CoverageOptions {
pub level: CoverageLevel,
/// `-Z coverage-options=no-mir-spans`: Don't extract block coverage spans
/// `-Zcoverage-options=no-mir-spans`: Don't extract block coverage spans
/// from MIR statements/terminators, making it easier to inspect/debug
/// branch and MC/DC coverage mappings.
///
/// For internal debugging only. If other code changes would make it hard
/// to keep supporting this flag, remove it.
pub no_mir_spans: bool,
/// `-Zcoverage-options=discard-all-spans-in-codegen`: During codgen,
/// discard all coverage spans as though they were invalid. Needed by
/// regression tests for #133606, because we don't have an easy way to
/// reproduce it from actual source code.
pub discard_all_spans_in_codegen: bool,
}
/// Controls whether branch coverage or MC/DC coverage is enabled.