Skip to content

Commit c3780e1

Browse files
committed
coverage: Quietly skip functions that end up having no mappings
In codegen, a used function with `FunctionCoverageInfo` but no mappings has historically indicated a bug. However, that will no longer be the case after moving some fallible span-processing steps into codegen.
1 parent d416cea commit c3780e1

File tree

1 file changed

+2
-7
lines changed
  • compiler/rustc_codegen_llvm/src/coverageinfo/mapgen

1 file changed

+2
-7
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rustc_abi::Align;
1010
use rustc_codegen_ssa::traits::{
1111
BaseTypeCodegenMethods, ConstCodegenMethods, StaticCodegenMethods,
1212
};
13-
use rustc_middle::bug;
1413
use rustc_middle::mir::coverage::{
1514
CovTerm, CoverageIdsInfo, Expression, FunctionCoverageInfo, Mapping, MappingKind, Op,
1615
};
@@ -67,12 +66,8 @@ pub(crate) fn prepare_covfun_record<'tcx>(
6766
fill_region_tables(tcx, global_file_table, fn_cov_info, ids_info, &mut covfun);
6867

6968
if covfun.regions.has_no_regions() {
70-
if covfun.is_used {
71-
bug!("a used function should have had coverage mapping data but did not: {covfun:?}");
72-
} else {
73-
debug!(?covfun, "unused function had no coverage mapping data");
74-
return None;
75-
}
69+
debug!(?covfun, "function has no mappings to embed; skipping");
70+
return None;
7671
}
7772

7873
Some(covfun)

0 commit comments

Comments
 (0)