Skip to content

Commit 8346b17

Browse files
author
Ariel Ben-Yehuda
committed
---
yaml --- r: 234993 b: refs/heads/stable c: fb5dd39 h: refs/heads/master i: 234991: db45d97 v: v3
1 parent a863bb0 commit 8346b17

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: a5e21daa1909f538ddd696f7baffad4603f38a5d
32+
refs/heads/stable: fb5dd398f677213e8f0943638c9205172a634efe
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/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)