]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
[rust.git] / tests / ui / mismatched_types / unboxed-closures-vtable-mismatch.rs
1 #![feature(unboxed_closures,tuple_trait)]
2
3 use std::ops::FnMut;
4
5 fn to_fn_mut<A:std::marker::Tuple, 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 defined here
16     let z = call_it(3, f);
17     //~^ ERROR type mismatch
18     //~| NOTE expected due to this
19     //~| NOTE expected closure signature `fn(isize, _) -> _`
20     //~| NOTE required by a bound introduced by this call
21     println!("{}", z);
22 }