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