-
Notifications
You must be signed in to change notification settings - Fork 13k
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
#[no_coverage] didn't exclude internal functions and closures inside a function #113564
Comments
@rustbot label +A-code-coverage +requires-nightly |
Yeah, the current implementation of From the instrumentation pass's point of view, every internal function/closure is treated as a completely separate function, and there's no logic to detect no-coverage attributes on enclosing items. I imagine this would be relatively straightforward to fix, by scanning all enclosing functions for the attribute (instead of just checking the current function), though I'm currently not familiar enough with MIR APIs to do it myself. |
I've filed #126625 to be the canonical version of this issue. |
@rustbot close |
Oops, I thought I could close this. I think we are good to close this now that #126625 has been closed |
Thus, require "#[cfg_attr(coverage_nightly, no_coverage)]" prepend before each internal functions/closures for coverage exclusion, e.g.:
https://github.com/mhfan/inrust/blob/d4bd798028b9d06709b1c65ef92993af805ba4a4/src/calc24.rs#L737C1-L762C6
taiki-e/cargo-llvm-cov#291
The text was updated successfully, but these errors were encountered: