Inlining enabled by -mir-opt-level > 1 is incompatible with coverage
Fixes: #80060 Also adds additional test cases for coverage of doctests.
This commit is contained in:
parent
bbcaed03bf
commit
e4aa99fe7a
7 changed files with 210 additions and 103 deletions
|
@ -41,6 +41,15 @@ impl<'tcx> MirPass<'tcx> for Inline {
|
|||
return;
|
||||
}
|
||||
|
||||
if tcx.sess.opts.debugging_opts.instrument_coverage {
|
||||
// Since `Inline` happens after `InstrumentCoverage`, the function-specific coverage
|
||||
// counters can be invalidated, such as by merging coverage counter statements from
|
||||
// a pre-inlined function into a different function. This kind of change is invalid,
|
||||
// so inlining must be skipped. Note: This check is performed here so inlining can
|
||||
// be disabled without preventing other optimizations (regardless of `mir_opt_level`).
|
||||
return;
|
||||
}
|
||||
|
||||
if inline(tcx, body) {
|
||||
debug!("running simplify cfg on {:?}", body.source);
|
||||
CfgSimplifier::new(body).simplify();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue