Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#121026 - Zalathar:version, r=oli-obk
coverage: Correctly report and check LLVM's coverage mapping version I was puzzled by the fact that the LLVM 18 update (rust-lang#120055) didn't need to modify this version check, despite the fact that LLVM 18 uses a newer version of the coverage mapping format. This turned out to be because we were inappropriately hard-coding a specific version (`Version6`) in the C++ wrapper, instead of using `CovMapVersion::CurrentVersion` to reflect the version actually used by LLVM on our behalf. This PR fixes that, and also changes the Rust-side version check to accept the new coverage mapping version used by LLVM 18, since the necessary compatibility work has already been done. --- ### Quick history of `LLVMRustCoverageMappingVersion`: - Originally it returned LLVM's `coverage::CovMapVersion::CurrentVersion`, as intended. The Rust-side code would verify it, and also embed it as the actual coverage version number in the output binary. - At some point it was changed to a hard-coded value, to work around a (now-irrelevant) compatibility issue. This was incorrect (but mostly benign), because the override should have been performed on the Rust side instead, after verifying LLVM's value. - Later contributors dutifully updated the hard-coded value, because they didn't have enough context to identify the problem. - With this PR, it once again returns LLVM's current coverage version number, and the Rust-side code checks it against an expected range. We don't override the result, but we do indicate where that override should occur if it ever becomes necessary.
- Loading branch information