From c3780e1d227d7544209e2cd722ac4fa35ac61b56 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Wed, 18 Dec 2024 21:23:48 +1100 Subject: 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. --- compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src') diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs index f9e9555e8bd..dca1779d821 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs @@ -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, }; @@ -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) -- cgit 1.4.1-3-g733a5