rust-lang/rust — pull request #16610 by pcwalton (2014-08-19 19:56:34+00:00)
Title: librustc: Require the `ref` keyword to get by-reference closure

captures.

Because captured variables are now captured by value by default, this
breaks code like:

let mut a = 10;
[ 1i, 2, 3 ].iter().map(|x| a += *x);

Change this code to:

let mut a = 10;
[ 1i, 2, 3 ].iter().map(ref |x| a += *x);

As a simple change, you may wish to uniformly add the `ref` keyword to
all old boxed closures. This will guarantee that the semantics remain
the same.

Issue #12831.

[breaking-change]

r? @alexcrichton