Skip to content

Commit fb5dd39

Browse files
author
Ariel Ben-Yehuda
committed
Remove now-useless code
1 parent a5e21da commit fb5dd39

File tree

1 file changed

+12
-40
lines changed

1 file changed

+12
-40
lines changed

src/librustc_trans/trans/cleanup.rs

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ pub struct CachedEarlyExit {
199199

200200
pub trait Cleanup<'tcx> {
201201
fn must_unwind(&self) -> bool;
202-
fn clean_on_unwind(&self) -> bool;
203202
fn is_lifetime_end(&self) -> bool;
204203
fn trans<'blk>(&self,
205204
bcx: Block<'blk, 'tcx>,
@@ -776,29 +775,19 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
776775
//
777776
// At this point, `popped_scopes` is empty, and so the final block
778777
// that we return to the user is `Cleanup(AST 24)`.
779-
while !popped_scopes.is_empty() {
780-
let mut scope = popped_scopes.pop().unwrap();
781-
782-
if scope.cleanups.iter().any(|c| cleanup_is_suitable_for(&**c, label))
783-
{
784-
let name = scope.block_name("clean");
785-
debug!("generating cleanups for {}", name);
786-
let bcx_in = self.new_block(label.is_unwind(),
787-
&name[..],
788-
None);
789-
let mut bcx_out = bcx_in;
790-
for cleanup in scope.cleanups.iter().rev() {
791-
if cleanup_is_suitable_for(&**cleanup, label) {
792-
bcx_out = cleanup.trans(bcx_out,
793-
scope.debug_loc);
794-
}
795-
}
796-
build::Br(bcx_out, prev_llbb, DebugLoc::None);
797-
prev_llbb = bcx_in.llbb;
798-
} else {
799-
debug!("no suitable cleanups in {}",
800-
scope.block_name("clean"));
778+
while let Some(mut scope) = popped_scopes.pop() {
779+
let name = scope.block_name("clean");
780+
debug!("generating cleanups for {}", name);
781+
let bcx_in = self.new_block(label.is_unwind(),
782+
&name[..],
783+
None);
784+
let mut bcx_out = bcx_in;
785+
for cleanup in scope.cleanups.iter().rev() {
786+
bcx_out = cleanup.trans(bcx_out,
787+
scope.debug_loc);
801788
}
789+
build::Br(bcx_out, prev_llbb, DebugLoc::None);
790+
prev_llbb = bcx_in.llbb;
802791

803792
scope.add_cached_early_exit(label, prev_llbb);
804793
self.push_scope(scope);
@@ -1038,10 +1027,6 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
10381027
true
10391028
}
10401029

1041-
fn clean_on_unwind(&self) -> bool {
1042-
true
1043-
}
1044-
10451030
fn is_lifetime_end(&self) -> bool {
10461031
false
10471032
}
@@ -1085,10 +1070,6 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
10851070
true
10861071
}
10871072

1088-
fn clean_on_unwind(&self) -> bool {
1089-
true
1090-
}
1091-
10921073
fn is_lifetime_end(&self) -> bool {
10931074
false
10941075
}
@@ -1118,10 +1099,6 @@ impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
11181099
false
11191100
}
11201101

1121-
fn clean_on_unwind(&self) -> bool {
1122-
true
1123-
}
1124-
11251102
fn is_lifetime_end(&self) -> bool {
11261103
true
11271104
}
@@ -1160,11 +1137,6 @@ pub fn var_scope(tcx: &ty::ctxt,
11601137
r
11611138
}
11621139

1163-
fn cleanup_is_suitable_for(c: &Cleanup,
1164-
label: EarlyExitLabel) -> bool {
1165-
!label.is_unwind() || c.clean_on_unwind()
1166-
}
1167-
11681140
///////////////////////////////////////////////////////////////////////////
11691141
// These traits just exist to put the methods into this file.
11701142

0 commit comments

Comments
 (0)