@@ -273,8 +273,9 @@ struct ExtractedHirInfo {
273273 /// Must have the same context and filename as the body span.
274274 fn_sig_span_extended : Option < Span > ,
275275 body_span : Span ,
276- /// "Holes" are regions within the body span that should not be included in
277- /// coverage spans for this function (e.g. closures and nested items).
276+ /// "Holes" are regions within the function body (or its expansions) that
277+ /// should not be included in coverage spans for this function
278+ /// (e.g. closures and nested items).
278279 hole_spans : Vec < Span > ,
279280}
280281
@@ -323,7 +324,7 @@ fn extract_hir_info<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ExtractedHir
323324
324325 let function_source_hash = hash_mir_source ( tcx, hir_body) ;
325326
326- let hole_spans = extract_hole_spans_from_hir ( tcx, body_span , hir_body) ;
327+ let hole_spans = extract_hole_spans_from_hir ( tcx, hir_body) ;
327328
328329 ExtractedHirInfo {
329330 function_source_hash,
@@ -340,14 +341,9 @@ fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &'tcx hir::Body<'tcx>) ->
340341 tcx. hir_owner_nodes ( owner) . opt_hash_including_bodies . unwrap ( ) . to_smaller_hash ( ) . as_u64 ( )
341342}
342343
343- fn extract_hole_spans_from_hir < ' tcx > (
344- tcx : TyCtxt < ' tcx > ,
345- body_span : Span , // Usually `hir_body.value.span`, but not always
346- hir_body : & hir:: Body < ' tcx > ,
347- ) -> Vec < Span > {
344+ fn extract_hole_spans_from_hir < ' tcx > ( tcx : TyCtxt < ' tcx > , hir_body : & hir:: Body < ' tcx > ) -> Vec < Span > {
348345 struct HolesVisitor < ' tcx > {
349346 tcx : TyCtxt < ' tcx > ,
350- body_span : Span ,
351347 hole_spans : Vec < Span > ,
352348 }
353349
@@ -387,14 +383,11 @@ fn extract_hole_spans_from_hir<'tcx>(
387383 }
388384 impl HolesVisitor < ' _ > {
389385 fn visit_hole_span ( & mut self , hole_span : Span ) {
390- // Discard any holes that aren't directly visible within the body span.
391- if self . body_span . contains ( hole_span) && self . body_span . eq_ctxt ( hole_span) {
392- self . hole_spans . push ( hole_span) ;
393- }
386+ self . hole_spans . push ( hole_span) ;
394387 }
395388 }
396389
397- let mut visitor = HolesVisitor { tcx, body_span , hole_spans : vec ! [ ] } ;
390+ let mut visitor = HolesVisitor { tcx, hole_spans : vec ! [ ] } ;
398391
399392 visitor. visit_body ( hir_body) ;
400393 visitor. hole_spans
0 commit comments