From 39344c2d7ec6fdacb7085aefda3e440891e0855a Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Thu, 2 Oct 2014 19:48:07 -0700 Subject: [PATCH] Rehabilitate an unboxed closure test This test works as a regression test for issue #17655. It also exercises mutation of by-ref upvars. --- src/test/run-pass/capture-clauses-unboxed-closures.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/test/run-pass/capture-clauses-unboxed-closures.rs b/src/test/run-pass/capture-clauses-unboxed-closures.rs index 99e6d6e7a4f..a826f4df5b3 100644 --- a/src/test/run-pass/capture-clauses-unboxed-closures.rs +++ b/src/test/run-pass/capture-clauses-unboxed-closures.rs @@ -8,13 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-test -// -// This is ignored because it depends on #16122. - #![feature(overloaded_calls, unboxed_closures)] -fn each<'a,T,F:|&mut: &'a T|>(x: &'a [T], mut f: F) { +fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) { for val in x.iter() { f(val) } @@ -23,7 +19,6 @@ fn each<'a,T,F:|&mut: &'a T|>(x: &'a [T], mut f: F) { fn main() { let mut sum = 0u; let elems = [ 1u, 2, 3, 4, 5 ]; - each(elems, ref |&mut: val: &uint| sum += *val); + each(elems, |&mut: val: &uint| sum += *val); assert_eq!(sum, 15); } - -- 2.44.0