Skip to content

Commit 11a902e

Browse files
committed
coverage: Regression test for inlining into an uninstrumented crate
1 parent b5f4883 commit 11a902e

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

Diff for: tests/coverage/auxiliary/inline_mixed_helper.rs

+13
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.

Diff for: tests/coverage/inline_mixed.coverage

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

Diff for: tests/coverage/inline_mixed.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ edition: 2021
2+
//@ compile-flags: -Cinstrument-coverage=off
3+
//@ aux-crate: inline_mixed_helper=inline_mixed_helper.rs
4+
5+
// Regression test for <https://github.com/rust-lang/rust/pull/132395>.
6+
// Various forms of cross-crate inlining can cause coverage statements to be
7+
// inlined into crates that are being built without coverage instrumentation.
8+
// At the very least, we need to not ICE when that happens.
9+
10+
fn main() {
11+
inline_mixed_helper::inline_me();
12+
inline_mixed_helper::no_inlining_please();
13+
inline_mixed_helper::generic::<u32>();
14+
}

0 commit comments

Comments
 (0)