]> git.lizzy.rs Git - rust.git/commitdiff
Do not forget to schedule the drop for the argument
authorSimonas Kazlauskas <git@kazlauskas.me>
Thu, 26 May 2016 08:26:03 +0000 (11:26 +0300)
committerSimonas Kazlauskas <git@kazlauskas.me>
Thu, 26 May 2016 08:26:03 +0000 (11:26 +0300)
src/librustc_trans/base.rs

index ddfa08516e59f765ccbc2e562c58b84e47ed29a0..712805061ea8cd026cda30d19f67bc882b062133 100644 (file)
@@ -1660,8 +1660,8 @@ fn bind_args(&'blk self,
                     self.schedule_drop_mem(arg_scope_id, llarg, arg_ty, None);
 
                     datum::Datum::new(llarg,
-                                    arg_ty,
-                                    datum::Lvalue::new("FunctionContext::bind_args"))
+                                      arg_ty,
+                                      datum::Lvalue::new("FunctionContext::bind_args"))
                 } else {
                     let lltmp = if common::type_is_fat_ptr(bcx.tcx(), arg_ty) {
                         let lltemp = alloc_ty(bcx, arg_ty, "");
@@ -1683,6 +1683,7 @@ fn bind_args(&'blk self,
                         // And coerce the temporary into the type we expect.
                         b.pointercast(lltemp, arg.memory_ty(bcx.ccx()).ptr_to())
                     };
+                    bcx.fcx.schedule_drop_mem(arg_scope_id, lltmp, arg_ty, None);
                     datum::Datum::new(lltmp, arg_ty,
                                       datum::Lvalue::new("bind_args"))
                 }