Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
Zalathar committed Dec 19, 2024
commit c3780e1d227d7544209e2cd722ac4fa35ac61b56
9 changes: 2 additions & 7 deletions compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rustc_abi::Align;
use rustc_codegen_ssa::traits::{
BaseTypeCodegenMethods, ConstCodegenMethods, StaticCodegenMethods,
};
use rustc_middle::bug;
use rustc_middle::mir::coverage::{
CovTerm, CoverageIdsInfo, Expression, FunctionCoverageInfo, Mapping, MappingKind, Op,
};
Expand Down Expand Up @@ -67,12 +66,8 @@ pub(crate) fn prepare_covfun_record<'tcx>(
fill_region_tables(tcx, global_file_table, fn_cov_info, ids_info, &mut covfun);

if covfun.regions.has_no_regions() {
if covfun.is_used {
bug!("a used function should have had coverage mapping data but did not: {covfun:?}");
} else {
debug!(?covfun, "unused function had no coverage mapping data");
return None;
}
debug!(?covfun, "function has no mappings to embed; skipping");
return None;
}

Some(covfun)
Expand Down