diff options
| author | bors <bors@rust-lang.org> | 2024-10-22 07:21:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-22 07:21:22 +0000 |
| commit | ca51c1e72cebbf0e6979339598b024c400536631 (patch) | |
| tree | b8e998e43a98e3cfe11d7b8b8ba0aaf4063ab905 /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | fa815a1cbbdb263bb6531d51ceb606e418e32d9a (diff) | |
| parent | efc2ba2d902e979770a17e2da6e3d289d6909812 (diff) | |
| download | rust-ca51c1e72cebbf0e6979339598b024c400536631.tar.gz rust-ca51c1e72cebbf0e6979339598b024c400536631.zip | |
Auto merge of #18364 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coverage/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs index d0f30314e79..2e4c503f3ce 100644 --- a/compiler/rustc_mir_transform/src/coverage/mod.rs +++ b/compiler/rustc_mir_transform/src/coverage/mod.rs @@ -524,6 +524,11 @@ fn extract_hir_info<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ExtractedHir // FIXME(#79625): Consider improving MIR to provide the information needed, to avoid going back // to HIR for it. + // HACK: For synthetic MIR bodies (async closures), use the def id of the HIR body. + if tcx.is_synthetic_mir(def_id) { + return extract_hir_info(tcx, tcx.local_parent(def_id)); + } + let hir_node = tcx.hir_node_by_def_id(def_id); let fn_body_id = hir_node.body_id().expect("HIR node is a function with body"); let hir_body = tcx.hir().body(fn_body_id); |
