]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-call-sugar-object.rs
Auto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomez
[rust.git] / tests / ui / unboxed-closures / unboxed-closures-call-sugar-object.rs
1 // run-pass
2 use std::ops::FnMut;
3
4 fn make_adder(x: isize) -> Box<dyn FnMut(isize)->isize + 'static> {
5     Box::new(move |y| { x + y })
6 }
7
8 pub fn main() {
9     let mut adder = make_adder(3);
10     let z = (*adder)(2);
11     println!("{}", z);
12     assert_eq!(z, 5);
13 }