Skip to content

Commit da6f75e

Browse files
committed
coverage: Don't use HIR to determine whether a def is fn-like
1 parent 1d4441d commit da6f75e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compiler/rustc_mir_build/src/build/coverageinfo.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ pub(crate) fn make_coverage_hir_info_if_eligible(
1717
}
1818

1919
fn is_eligible_for_coverage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
20-
let is_fn_like = tcx.hir().get_by_def_id(def_id).fn_kind().is_some();
21-
2220
// Only instrument functions, methods, and closures (not constants since they are evaluated
2321
// at compile time by Miri).
2422
// FIXME(#73156): Handle source code coverage in const eval, but note, if and when const
2523
// expressions get coverage spans, we will probably have to "carve out" space for const
2624
// expressions from coverage spans in enclosing MIR's, like we do for closures. (That might
2725
// be tricky if const expressions have no corresponding statements in the enclosing MIR.
2826
// Closures are carved out by their initial `Assign` statement.)
29-
if !is_fn_like {
27+
if !tcx.def_kind(def_id).is_fn_like() {
3028
return false;
3129
}
3230

0 commit comments

Comments
 (0)