2024-12-22 03:26:54 +00:00
|
|
|
#![feature(coverage_attribute)]
|
2023-12-08 04:51:06 +00:00
|
|
|
//@ edition: 2021
|
|
|
|
|
2025-04-12 07:52:55 +00:00
|
|
|
// Test that coverage instrumentation can gracefully handle functions that end
|
|
|
|
// up having no relevant spans, without crashing the compiler or causing
|
|
|
|
// `llvm-cov` to fail.
|
2023-12-08 04:51:06 +00:00
|
|
|
//
|
2025-04-12 07:52:55 +00:00
|
|
|
// This was originally a regression test for issues such as #118643 and #118662.
|
2023-12-08 04:51:06 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
affected_function()();
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! macro_that_defines_a_function {
|
|
|
|
(fn $name:ident () $body:tt) => {
|
|
|
|
fn $name () -> impl Fn() $body
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_that_defines_a_function! {
|
|
|
|
fn affected_function() {
|
|
|
|
|| ()
|
|
|
|
}
|
|
|
|
}
|