2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-01-02 14:30:26 -06:00
|
|
|
// Test that the call operator autoderefs when calling a bounded type parameter.
|
|
|
|
|
|
|
|
use std::ops::FnMut;
|
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn call_with_2<F>(x: &mut F) -> isize
|
|
|
|
where F : FnMut(isize) -> isize
|
2015-01-02 14:30:26 -06:00
|
|
|
{
|
|
|
|
x(2) // look ma, no `*`
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let z = call_with_2(&mut |x| x - 22);
|
|
|
|
assert_eq!(z, -20);
|
|
|
|
}
|