-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Missing coverage on assert!(!...)
statements
#118904
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
assert!(!...)
statementassert!(!...)
statements
Might be that llvm just optimizes it out as dead code. Do you see it with -Copt-level=0 ? |
@matthiaskrgr: I think |
cc @Zalathar |
I can reproduce this with It was probably fixed by #118198. |
Would it make sense to add a test for this specifically? |
PR filed: #119011 |
coverage: Regression test for `assert!(!false)` This verifies that rust-lang#118904 has already been fixed by rust-lang#118198. --- `@rustbot` label +A-code-coverage
coverage: Regression test for `assert!(!false)` This verifies that rust-lang#118904 has already been fixed by rust-lang#118198. --- `@rustbot` label +A-code-coverage
A bit late, but I re-tested this on Rust 1.80.0 and it look like #119011 fixed the issue. I think we are good to close this issue 👍 |
I tried this code:
I expected to see this happen: Run this program with
cargo-llvm-cov
:cargo llvm-cov run --html
, I expect the source code should be fully covered.Instead, this happened: The
assert!
part in the source code is not covered. But if I change!false
totrue
, the source will be fully covered, it seems that I can’t getassert!
to be covered as long as the argument starts with an!
operator.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: