replace assert with condition and fatal error

This commit is contained in:
Rich Kadel 2020-11-25 11:38:09 -08:00 committed by GitHub
parent b4668ecb73
commit b1df6c0e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,9 @@ pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
// Ensure LLVM supports Coverage Map Version 4 (encoded as a zero-based value: 3).
// If not, the LLVM Version must be less than 11.
let version = coverageinfo::mapping_version();
assert_eq!(version, 3, "rustc option `-Z instrument-coverage` requires LLVM 11 or higher.");
if version != 3 {
cx.tcx.sess.fatal("rustc option `-Z instrument-coverage` requires LLVM 11 or higher.");
}```
let function_coverage_map = match cx.coverage_context() {
Some(ctx) => ctx.take_function_coverage_map(),