@@ -273,8 +273,9 @@ struct ExtractedHirInfo {
273
273
/// Must have the same context and filename as the body span.
274
274
fn_sig_span_extended : Option < Span > ,
275
275
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).
278
279
hole_spans : Vec < Span > ,
279
280
}
280
281
@@ -323,7 +324,7 @@ fn extract_hir_info<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ExtractedHir
323
324
324
325
let function_source_hash = hash_mir_source ( tcx, hir_body) ;
325
326
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) ;
327
328
328
329
ExtractedHirInfo {
329
330
function_source_hash,
@@ -340,14 +341,9 @@ fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &'tcx hir::Body<'tcx>) ->
340
341
tcx. hir_owner_nodes ( owner) . opt_hash_including_bodies . unwrap ( ) . to_smaller_hash ( ) . as_u64 ( )
341
342
}
342
343
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 > {
348
345
struct HolesVisitor < ' tcx > {
349
346
tcx : TyCtxt < ' tcx > ,
350
- body_span : Span ,
351
347
hole_spans : Vec < Span > ,
352
348
}
353
349
@@ -387,14 +383,11 @@ fn extract_hole_spans_from_hir<'tcx>(
387
383
}
388
384
impl HolesVisitor < ' _ > {
389
385
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) ;
394
387
}
395
388
}
396
389
397
- let mut visitor = HolesVisitor { tcx, body_span , hole_spans : vec ! [ ] } ;
390
+ let mut visitor = HolesVisitor { tcx, hole_spans : vec ! [ ] } ;
398
391
399
392
visitor. visit_body ( hir_body) ;
400
393
visitor. hole_spans
0 commit comments