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