]> git.proxmox.com Git - rustc.git/blame - 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
CommitLineData
1a4d82fc 1#![feature(unboxed_closures)]
970d7e83 2
1a4d82fc 3use std::ops::FnMut;
223e47cc 4
85aaf69f
SL
5fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
6
7fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize {
e1599b0c 8//~^ NOTE required by this bound in `call_it`
1a4d82fc 9 f(2, y)
223e47cc
LB
10}
11
12pub fn main() {
85aaf69f 13 let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
2c00a5a8 14 //~^ NOTE found signature of `fn(usize, isize) -> _`
85aaf69f
SL
15 let z = call_it(3, f);
16 //~^ ERROR type mismatch
2c00a5a8 17 //~| NOTE expected signature of `fn(isize, isize) -> _`
1a4d82fc 18 println!("{}", z);
223e47cc 19}