From f9b37c73480345c5cb4076cbaf67dc36df689919 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Mon, 31 Jan 2011 12:06:27 -0800 Subject: [PATCH] Run cleanups in reverse order. Not presently observable, no dtors. --- src/comp/middle/trans.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index ee695b881fd..deff03b475f 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3145,7 +3145,10 @@ fn trans_block_cleanups(@block_ctxt cx, check (_vec.len[cleanup](cleanup_cx.cleanups) == 0u); } - for (cleanup c in cleanup_cx.cleanups) { + auto i = _vec.len[cleanup](cleanup_cx.cleanups); + while (i > 0u) { + i -= 1u; + auto c = cleanup_cx.cleanups.(i); alt (c) { case (clean(?cfn)) { bcx = cfn(bcx).bcx;