]> git.proxmox.com Git - rustc.git/blob - src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs
New upstream version 1.44.1+dfsg1
[rustc.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 }