Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage: Regression test for inlining into an uninstrumented crate #132437

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/coverage/auxiliary/inline_mixed_helper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ edition: 2021
//@ compile-flags: -Cinstrument-coverage=on

#[inline]
pub fn inline_me() {}

#[inline(never)]
pub fn no_inlining_please() {}

pub fn generic<T>() {}

// FIXME(#132436): Even though this doesn't ICE, it still produces coverage
// reports that undercount the affected code.
19 changes: 19 additions & 0 deletions tests/coverage/inline_mixed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ edition: 2021
//@ compile-flags: -Cinstrument-coverage=off
//@ ignore-coverage-run
//@ aux-crate: inline_mixed_helper=inline_mixed_helper.rs

// Regression test for <https://github.com/rust-lang/rust/pull/132395>.
// Various forms of cross-crate inlining can cause coverage statements to be
// inlined into crates that are being built without coverage instrumentation.
// At the very least, we need to not ICE when that happens.

fn main() {
inline_mixed_helper::inline_me();
inline_mixed_helper::no_inlining_please();
inline_mixed_helper::generic::<u32>();
}

// FIXME(#132437): We currently don't test this in coverage-run mode, because
// whether or not it produces a `.profraw` file appears to differ between
// platforms.
Loading