Skip to content

Commit 39344c2

Browse files
committed
Rehabilitate an unboxed closure test
This test works as a regression test for issue #17655. It also exercises mutation of by-ref upvars.
1 parent c4c19fe commit 39344c2

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/test/run-pass/capture-clauses-unboxed-closures.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-test
12-
//
13-
// This is ignored because it depends on #16122.
14-
1511
#![feature(overloaded_calls, unboxed_closures)]
1612

17-
fn each<'a,T,F:|&mut: &'a T|>(x: &'a [T], mut f: F) {
13+
fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
1814
for val in x.iter() {
1915
f(val)
2016
}
@@ -23,7 +19,6 @@ fn each<'a,T,F:|&mut: &'a T|>(x: &'a [T], mut f: F) {
2319
fn main() {
2420
let mut sum = 0u;
2521
let elems = [ 1u, 2, 3, 4, 5 ];
26-
each(elems, ref |&mut: val: &uint| sum += *val);
22+
each(elems, |&mut: val: &uint| sum += *val);
2723
assert_eq!(sum, 15);
2824
}
29-

0 commit comments

Comments
 (0)