]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs
Rollup merge of #89945 - JohnTitor:we-now-specialize-clone-from-slice, r=the8472
[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 //~| NOTE required by a bound in `call_it`
10     f(2, y)
11 }
12
13 pub fn main() {
14     let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
15     //~^ NOTE found signature of `fn(usize, isize) -> _`
16     let z = call_it(3, f);
17     //~^ ERROR type mismatch
18     //~| NOTE expected signature of `fn(isize, isize) -> _`
19     //~| NOTE required by a bound introduced by this call
20     println!("{}", z);
21 }