Introduce -C instrument-coverage=branch to gate branch coverage

This flag has to be used in combination with `-Zunstable-options`,
and is added in advance of adding branch coverage instrumentation.
This commit is contained in:
Arpad Borsos 2023-08-21 10:54:37 +02:00 committed by Arpad Borsos
parent 1322f92634
commit 2b36547e9c
No known key found for this signature in database
GPG key ID: FC7BCA77824B3298
7 changed files with 19 additions and 6 deletions

View file

@ -169,6 +169,9 @@ pub enum MirSpanview {
pub enum InstrumentCoverage {
/// Default `-C instrument-coverage` or `-C instrument-coverage=statement`
All,
/// Additionally, instrument branches and output branch coverage.
/// `-Zunstable-options -C instrument-coverage=branch`
Branch,
/// `-Zunstable-options -C instrument-coverage=except-unused-generics`
ExceptUnusedGenerics,
/// `-Zunstable-options -C instrument-coverage=except-unused-functions`
@ -2747,7 +2750,10 @@ pub fn build_session_options(
}
(Some(InstrumentCoverage::Off | InstrumentCoverage::All), _) => {}
(Some(_), _) if !unstable_opts.unstable_options => {
handler.early_error("`-C instrument-coverage=except-*` requires `-Z unstable-options`");
handler.early_error(
"`-C instrument-coverage=branch` and `-C instrument-coverage=except-*` \
require `-Z unstable-options`",
);
}
(None, None) => {}
(None, ic) => {