]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs
Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorino
[rust.git] / src / test / ui / unboxed-closures / unboxed-closures-call-sugar-object-autoderef.rs
1 // run-pass
2 // Test that the call operator autoderefs when calling to an object type.
3
4 use std::ops::FnMut;
5
6 fn make_adder(x: isize) -> Box<dyn FnMut(isize)->isize + 'static> {
7     Box::new(move |y| { x + y })
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 }