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.
This commit is contained in:
parent
d416cead5a
commit
c3780e1d22
1 changed files with 2 additions and 7 deletions
|
@ -10,7 +10,6 @@ use rustc_abi::Align;
|
||||||
use rustc_codegen_ssa::traits::{
|
use rustc_codegen_ssa::traits::{
|
||||||
BaseTypeCodegenMethods, ConstCodegenMethods, StaticCodegenMethods,
|
BaseTypeCodegenMethods, ConstCodegenMethods, StaticCodegenMethods,
|
||||||
};
|
};
|
||||||
use rustc_middle::bug;
|
|
||||||
use rustc_middle::mir::coverage::{
|
use rustc_middle::mir::coverage::{
|
||||||
CovTerm, CoverageIdsInfo, Expression, FunctionCoverageInfo, Mapping, MappingKind, Op,
|
CovTerm, CoverageIdsInfo, Expression, FunctionCoverageInfo, Mapping, MappingKind, Op,
|
||||||
};
|
};
|
||||||
|
@ -67,13 +66,9 @@ pub(crate) fn prepare_covfun_record<'tcx>(
|
||||||
fill_region_tables(tcx, global_file_table, fn_cov_info, ids_info, &mut covfun);
|
fill_region_tables(tcx, global_file_table, fn_cov_info, ids_info, &mut covfun);
|
||||||
|
|
||||||
if covfun.regions.has_no_regions() {
|
if covfun.regions.has_no_regions() {
|
||||||
if covfun.is_used {
|
debug!(?covfun, "function has no mappings to embed; skipping");
|
||||||
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;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Some(covfun)
|
Some(covfun)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue