From 7e210a8129c844e0b3aca4a28153effd0817ef41 Mon Sep 17 00:00:00 2001 From: blake2-ppc Date: Wed, 31 Jul 2013 21:07:45 +0200 Subject: std: Replace `for` with `do { .. }` expr in std::gc Change all users of old-style for with internal iterators to using `do`-loops. The code in stackwalk.rs does not actually implement the looping protocol (no break on return false). The code in gc.rs does not use loop breaks, nor does any code using it. We remove the capacity to break from the loops in std::gc and implement the walks using `do { .. }` expressions. No behavior change. --- src/libstd/stackwalk.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/libstd/stackwalk.rs') diff --git a/src/libstd/stackwalk.rs b/src/libstd/stackwalk.rs index c3e3ca57a8e..cc516fb559e 100644 --- a/src/libstd/stackwalk.rs +++ b/src/libstd/stackwalk.rs @@ -25,7 +25,7 @@ pub fn Frame(fp: *Word) -> Frame { } } -pub fn walk_stack(visit: &fn(Frame) -> bool) -> bool { +pub fn walk_stack(visit: &fn(Frame)) { debug!("beginning stack walk"); @@ -51,12 +51,11 @@ pub fn walk_stack(visit: &fn(Frame) -> bool) -> bool { } } } - return true; } #[test] fn test_simple() { - for walk_stack |_frame| { + do walk_stack |_frame| { } } @@ -65,7 +64,7 @@ fn test_simple_deep() { fn run(i: int) { if i == 0 { return } - for walk_stack |_frame| { + do walk_stack |_frame| { // Would be nice to test something here... } run(i - 1); -- cgit 1.4.1-3-g733a5