]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-boxed.rs
diagnostics: give a special note for unsafe fn / Fn/FnOnce/FnMut
[rust.git] / src / test / ui / unboxed-closures / unboxed-closures-boxed.rs
1 // run-pass
2
3 use std::ops::FnMut;
4
5  fn make_adder(x: i32) -> Box<dyn FnMut(i32)->i32+'static> {
6     Box::new(move |y: i32| -> i32 { x + y }) as
7         Box<dyn FnMut(i32)->i32+'static>
8 }
9
10 pub fn main() {
11     let mut adder = make_adder(3);
12     let z = adder(2);
13     println!("{}", z);
14     assert_eq!(z, 5);
15 }