]> git.lizzy.rs Git - rust.git/commitdiff
replace assert with condition and `fatal` error
authorRich Kadel <richkadel@google.com>
Wed, 25 Nov 2020 19:38:09 +0000 (11:38 -0800)
committerGitHub <noreply@github.com>
Wed, 25 Nov 2020 19:38:09 +0000 (11:38 -0800)
compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

index ff65726c83793f64bbe638139dbf4854139db4f9..87eada5d5570667a9dbba3b53c103ae02ad7a9fb 100644 (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(),