]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs
Auto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomez
[rust.git] / tests / ui / unboxed-closures / unboxed-closures-call-sugar-autoderef.rs
1 // run-pass
2 // Test that the call operator autoderefs when calling a bounded type parameter.
3
4 use std::ops::FnMut;
5
6 fn call_with_2<F>(x: &mut F) -> isize
7     where F : FnMut(isize) -> isize
8 {
9     x(2) // look ma, no `*`
10 }
11
12 pub fn main() {
13     let z = call_with_2(&mut |x| x - 22);
14     assert_eq!(z, -20);
15 }