-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Open
Labels
A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)Area: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
A simple test of the -C instrument-coverage feature returns the wrong count (9 instead of 10) of the loop header on line 4 when built with Rust 1.93.0:
main.rs:
fn main(){
let mut sum: u32 = 0;
for i in 1..10 {
sum += i;
}
if false{
println!("This code can't be reached");
}
println!("Sum: {}", sum);
}Reproducer:
rustc -C instrument-coverage main.rs -o main
LLVM_PROFILE_FILE='testprof.profraw' ./main
llvm-profdata merge -sparse testprof.profraw -o testprof.profdata
llvm-cov show main -instr-profile=testprof.profdata > coverage.out
This test works as expected with 1.92.0.
Meta
$ rustc +1.93.0 --version
rustc 1.93.0 (254b59607 2026-01-19)
Metadata
Metadata
Assignees
Labels
A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)Area: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.