]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
[rust.git] / src / test / ui / mismatched_types / unboxed-closures-vtable-mismatch.rs
1 #![feature(unboxed_closures)]
2
3 use std::ops::FnMut;
4
5 fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
6
7 fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize {
8 //~^ NOTE required by this bound in `call_it`
9     f(2, y)
10 }
11
12 pub fn main() {
13     let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
14     //~^ NOTE found signature of `fn(usize, isize) -> _`
15     let z = call_it(3, f);
16     //~^ ERROR type mismatch
17     //~| NOTE expected signature of `fn(isize, isize) -> _`
18     println!("{}", z);
19 }