about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2015-06-30 02:31:07 +0300
committerAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2015-06-30 02:31:07 +0300
commitfb5dd398f677213e8f0943638c9205172a634efe (patch)
tree2324417be72ebadd942448e32197c78a2fc05324
parenta5e21daa1909f538ddd696f7baffad4603f38a5d (diff)
downloadrust-fb5dd398f677213e8f0943638c9205172a634efe.tar.gz
rust-fb5dd398f677213e8f0943638c9205172a634efe.zip
Remove now-useless code
-rw-r--r--src/librustc_trans/trans/cleanup.rs52
1 files changed, 12 insertions, 40 deletions
diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs
index 0b4d7e602be..588e4cea504 100644
--- a/src/librustc_trans/trans/cleanup.rs
+++ b/src/librustc_trans/trans/cleanup.rs
@@ -199,7 +199,6 @@ pub struct CachedEarlyExit {
 
 pub trait Cleanup<'tcx> {
     fn must_unwind(&self) -> bool;
-    fn clean_on_unwind(&self) -> bool;
     fn is_lifetime_end(&self) -> bool;
     fn trans<'blk>(&self,
                    bcx: Block<'blk, 'tcx>,
@@ -776,29 +775,19 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
         //
         // At this point, `popped_scopes` is empty, and so the final block
         // that we return to the user is `Cleanup(AST 24)`.
-        while !popped_scopes.is_empty() {
-            let mut scope = popped_scopes.pop().unwrap();
-
-            if scope.cleanups.iter().any(|c| cleanup_is_suitable_for(&**c, label))
-            {
-                let name = scope.block_name("clean");
-                debug!("generating cleanups for {}", name);
-                let bcx_in = self.new_block(label.is_unwind(),
-                                            &name[..],
-                                            None);
-                let mut bcx_out = bcx_in;
-                for cleanup in scope.cleanups.iter().rev() {
-                    if cleanup_is_suitable_for(&**cleanup, label) {
-                        bcx_out = cleanup.trans(bcx_out,
-                                                scope.debug_loc);
-                    }
-                }
-                build::Br(bcx_out, prev_llbb, DebugLoc::None);
-                prev_llbb = bcx_in.llbb;
-            } else {
-                debug!("no suitable cleanups in {}",
-                       scope.block_name("clean"));
+        while let Some(mut scope) = popped_scopes.pop() {
+            let name = scope.block_name("clean");
+            debug!("generating cleanups for {}", name);
+            let bcx_in = self.new_block(label.is_unwind(),
+                                        &name[..],
+                                        None);
+            let mut bcx_out = bcx_in;
+            for cleanup in scope.cleanups.iter().rev() {
+                bcx_out = cleanup.trans(bcx_out,
+                                        scope.debug_loc);
             }
+            build::Br(bcx_out, prev_llbb, DebugLoc::None);
+            prev_llbb = bcx_in.llbb;
 
             scope.add_cached_early_exit(label, prev_llbb);
             self.push_scope(scope);
@@ -1038,10 +1027,6 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
         true
     }
 
-    fn clean_on_unwind(&self) -> bool {
-        true
-    }
-
     fn is_lifetime_end(&self) -> bool {
         false
     }
@@ -1085,10 +1070,6 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
         true
     }
 
-    fn clean_on_unwind(&self) -> bool {
-        true
-    }
-
     fn is_lifetime_end(&self) -> bool {
         false
     }
@@ -1118,10 +1099,6 @@ impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
         false
     }
 
-    fn clean_on_unwind(&self) -> bool {
-        true
-    }
-
     fn is_lifetime_end(&self) -> bool {
         true
     }
@@ -1160,11 +1137,6 @@ pub fn var_scope(tcx: &ty::ctxt,
     r
 }
 
-fn cleanup_is_suitable_for(c: &Cleanup,
-                           label: EarlyExitLabel) -> bool {
-    !label.is_unwind() || c.clean_on_unwind()
-}
-
 ///////////////////////////////////////////////////////////////////////////
 // These traits just exist to put the methods into this file.