]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_codegen_ssa/src/mir/place.rs
Fix closed over variables not available in debuginfo for Windows MSVC
[rust.git] / compiler / rustc_codegen_ssa / src / mir / place.rs
index 66d9d1a1e0c490ef2237a25e1602c92f8ceda921..a9e7ebf6d43f72f178551e95592679bd8f683a0a 100644 (file)
@@ -402,6 +402,18 @@ pub fn project_downcast<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
         downcast
     }
 
+    pub fn project_deref<Bx: BuilderMethods<'a, 'tcx, Value = V>>(&self, bx: &mut Bx) -> Self {
+        let target_ty = self.layout.ty.builtin_deref(true).expect("failed to deref");
+        let layout = bx.layout_of(target_ty.ty);
+
+        PlaceRef {
+            llval: bx.load(self.llval, self.align),
+            llextra: None,
+            layout,
+            align: layout.align.abi,
+        }
+    }
+
     pub fn storage_live<Bx: BuilderMethods<'a, 'tcx, Value = V>>(&self, bx: &mut Bx) {
         bx.lifetime_start(self.llval, self.layout.size);
     }