about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-27 16:08:30 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-27 16:08:30 +0200
commit24f213d0231c04c2bde1ca65bb5dc93df7c4aaa7 (patch)
tree8283751cb3e9d53a0a55e0574db7d251d2f47508 /src
parentb0a4808757fda7ae4d047e570f0936b969eb6e42 (diff)
downloadrust-24f213d0231c04c2bde1ca65bb5dc93df7c4aaa7.tar.gz
rust-24f213d0231c04c2bde1ca65bb5dc93df7c4aaa7.zip
drive-by fix: scheduled drops are executed in reverse order.
That is, scheduled drops are executed in reverse order, so for
correctness, we *schedule* the lifetime end before we schedule the
drop, so that when they are executed, the drop will be executed
*before* the lifetime end.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_trans/trans/_match.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index 1aa996a05ac..41d32304582 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -916,8 +916,8 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
 
         let datum = Datum::new(llval, binding_info.ty, Lvalue);
         if let Some(cs) = cs {
-            bcx.fcx.schedule_drop_and_fill_mem(cs, llval, binding_info.ty);
             bcx.fcx.schedule_lifetime_end(cs, binding_info.llmatch);
+            bcx.fcx.schedule_drop_and_fill_mem(cs, llval, binding_info.ty);
         }
 
         debug!("binding {} to {}", binding_info.id, bcx.val_to_string(llval));