Open davidbarsky opened 2 years ago
I've confirmed that #[async_trait]
doesn't have this issue. cargo rustc --profile=check -- -Zunpretty=expanded
does show that the #[instrument]
macro expands into something a bit more complex than #[async_trait]
.
This might be caused by https://github.com/rust-lang/rust/issues/110486.
I've confirmed that this is still an issue on rustc 1.77.0-nightly (a2d9d73e6 2024-01-10).
Bug Report
Version
I made a reproduction in davidbarsky/tracing-coverage-reproduction. Note that to reproduce this issue,
llvm-tools-preview
andgrcov
are required. To install those tools:Platform
Crates
tracing 0.1.32
Description
The
#[instrument]
macro appears to mess with the LLVM's code coverage. This might be inherent to macros that rewrite function bodies, as#[instrument]
does. Here is the code coverage on a function decorated with#[instrument]
:...and here is a function without
#[instrument]
:(This was reported to me by @DirectXMan12.)