1
Fork 0

Auto merge of #127234 - ZhuUx:inlined-expr, r=davidtwco,Zalathar

[Coverage][MCDC] Group mcdc tests and fix panic when generating mcdc code for inlined expressions.

### Changes

1. Group all mcdc tests to one directory.
2. Since mcdc instruments different mappings for boolean expressions with normal branch coverage as #125766 introduces, it would be better also trace branch coverage results in mcdc tests.
3. So far rustc does not call `CoverageInfoBuilderMethods::init_coverage` for inlined functions. As a result, it could panic if it tries to instrument mcdc statements for inlined functions due to uninitialized cond bitmaps. We can reproduce this issue by current nightly rustc and [the test](https://github.com/rust-lang/rust/pull/127234/files#diff-c81af6bf4869aa42f5c7334e3e86344475de362f673f54ce439ec75fcb5ac3e5) with flag `--release`. This patch fixes it.
This commit is contained in:
bors 2024-07-09 20:24:30 +00:00
commit 6be96e3865
13 changed files with 181 additions and 24 deletions

View file

@ -41,6 +41,12 @@ struct CallSite<'tcx> {
impl<'tcx> MirPass<'tcx> for Inline {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
// FIXME(#127234): Coverage instrumentation currently doesn't handle inlined
// MIR correctly when Modified Condition/Decision Coverage is enabled.
if sess.instrument_coverage_mcdc() {
return false;
}
if let Some(enabled) = sess.opts.unstable_opts.inline_mir {
return enabled;
}