Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 885b6a2

Browse files
authoredNov 3, 2024··
Unrolled build for rust-lang#132437
Rollup merge of rust-lang#132437 - Zalathar:inline-mixed-regression, r=jieyouxu coverage: Regression test for inlining into an uninstrumented crate Regression test for rust-lang#132395, after I was able to figure out a simple way to reproduce it. See also rust-lang#132436. In addition to confirming that there is no ICE, this test also demonstrates that the affected code is undercounted, because executing the inlined copy doesn't increment coverage counters.
2 parents 59ae5eb + afe1902 commit 885b6a2

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ edition: 2021
2+
//@ compile-flags: -Cinstrument-coverage=on
3+
4+
#[inline]
5+
pub fn inline_me() {}
6+
7+
#[inline(never)]
8+
pub fn no_inlining_please() {}
9+
10+
pub fn generic<T>() {}
11+
12+
// FIXME(#132436): Even though this doesn't ICE, it still produces coverage
13+
// reports that undercount the affected code.

‎tests/coverage/inline_mixed.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ edition: 2021
2+
//@ compile-flags: -Cinstrument-coverage=off
3+
//@ ignore-coverage-run
4+
//@ aux-crate: inline_mixed_helper=inline_mixed_helper.rs
5+
6+
// Regression test for <https://github.com/rust-lang/rust/pull/132395>.
7+
// Various forms of cross-crate inlining can cause coverage statements to be
8+
// inlined into crates that are being built without coverage instrumentation.
9+
// At the very least, we need to not ICE when that happens.
10+
11+
fn main() {
12+
inline_mixed_helper::inline_me();
13+
inline_mixed_helper::no_inlining_please();
14+
inline_mixed_helper::generic::<u32>();
15+
}
16+
17+
// FIXME(#132437): We currently don't test this in coverage-run mode, because
18+
// whether or not it produces a `.profraw` file appears to differ between
19+
// platforms.

0 commit comments

Comments
 (0)
Please sign in to comment.