// rustc -V // rustc 1.2.0-nightly (0cc99f9cc 2015-05-17) (built 2015-05-18) use std::ops::Add; fn foo(n: Num) -> Box Num> where Num: Add + Copy + 'static { let mut acc = n; Box::new(move |i: Num| { acc = acc + i; acc }) } fn main() { let mut x = foo(1.); x(5.); foo(3.); println!("{}", x(2.3)); }