1 // run-pass 2 // Test that the call operator autoderefs when calling to an object type. 3 4 use std::ops::FnMut; 5 make_adder(x: isize) -> Box<dyn FnMut(isize)->isize + 'static>6fn make_adder(x: isize) -> Box<dyn FnMut(isize)->isize + 'static> { 7 Box::new(move |y| { x + y }) 8 } 9 main()10pub fn main() { 11 let mut adder = make_adder(3); 12 let z = adder(2); 13 println!("{}", z); 14 assert_eq!(z, 5); 15 } 16