diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-02-15 22:39:56 -0800 | 
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-02-15 23:20:52 -0800 | 
| commit | 7e35729bfc2bbc0942ce8929d3c4d28cee7ca040 (patch) | |
| tree | f58c9ee4383cba73ae2761149cca7ea24e8ac49a /compiler/rustc_mir_transform/src/patch.rs | |
| parent | 54a0f387ea8c7bcb79b8e40c074a484d31b51990 (diff) | |
| download | rust-7e35729bfc2bbc0942ce8929d3c4d28cee7ca040.tar.gz rust-7e35729bfc2bbc0942ce8929d3c4d28cee7ca040.zip  | |
Don't project into `NonNull` when dropping a `Box`
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 72cd9c224f6..b4f6fa514a4 100644 --- a/compiler/rustc_mir_transform/src/patch.rs +++ b/compiler/rustc_mir_transform/src/patch.rs @@ -166,6 +166,14 @@ impl<'tcx> MirPatch<'tcx> { Local::new(index) } + /// Returns the type of a local that's newly-added in the patch. + pub(crate) fn local_ty(&self, local: Local) -> Ty<'tcx> { + let local = local.as_usize(); + assert!(local < self.next_local); + let new_local_idx = self.new_locals.len() - (self.next_local - local); + self.new_locals[new_local_idx].ty + } + pub(crate) fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock { let block = BasicBlock::new(self.patch_map.len()); debug!("MirPatch: new_block: {:?}: {:?}", block, data);  | 
