forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
coverage: Regression test for inlining into an uninstrumented crate
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |