diff options
| author | Andrew Zhogin <andrew.zhogin@gmail.com> | 2024-08-26 16:45:15 +0300 |
|---|---|---|
| committer | Andrew Zhogin <andrew.zhogin@gmail.com> | 2025-04-28 16:23:13 +0700 |
| commit | c366756a8537ef998d32c1ef57098d5aae7ca92f (patch) | |
| tree | 9e2bb71eee25b90a0ddee1b15ed8ba339d5f0d9e /compiler/rustc_mir_transform/src/patch.rs | |
| parent | 52c1838fa712ee60d35b0d8cb6d4df3225430176 (diff) | |
| download | rust-c366756a8537ef998d32c1ef57098d5aae7ca92f.tar.gz rust-c366756a8537ef998d32c1ef57098d5aae7ca92f.zip | |
AsyncDrop implementation using shim codegen of async_drop_in_place::{closure}, scoped async drop added.
Diffstat (limited to 'compiler/rustc_mir_transform/src/patch.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/patch.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/patch.rs b/compiler/rustc_mir_transform/src/patch.rs index 12ace04c5e2..c7eb2a921c7 100644 --- a/compiler/rustc_mir_transform/src/patch.rs +++ b/compiler/rustc_mir_transform/src/patch.rs @@ -148,6 +148,14 @@ impl<'tcx> MirPatch<'tcx> { self.term_patch_map[bb].is_some() } + pub(crate) fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location { + let offset = match bb.index().checked_sub(body.basic_blocks.len()) { + Some(index) => self.new_blocks[index].statements.len(), + None => body[bb].statements.len(), + }; + Location { block: bb, statement_index: offset } + } + /// Queues the addition of a new temporary with additional local info. pub(crate) fn new_local_with_info( &mut self, |
