From b1df6c0e63ae1b5f42a1039e03ce77a491780147 Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Wed, 25 Nov 2020 11:38:09 -0800 Subject: [PATCH] replace assert with condition and `fatal` error --- compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index ff65726c837..87eada5d557 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -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(),