]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | #![feature(box_syntax)] |
2 | ||
3 | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {} | |
4 | ||
5 | fn main() { | |
dc9dc135 | 6 | let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>; |
c34b1796 | 7 | //~^ ERROR mismatched types |
a7813a04 | 8 | //~| expected type `()` |
8faf50e0 | 9 | //~| found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>` |
dc9dc135 | 10 | let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>; |
85aaf69f | 11 | //~^ ERROR mismatched types |
a7813a04 | 12 | //~| expected type `()` |
8faf50e0 | 13 | //~| found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>` |
dc9dc135 | 14 | let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>; |
85aaf69f | 15 | //~^ ERROR mismatched types |
a7813a04 | 16 | //~| expected type `()` |
8faf50e0 | 17 | //~| found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>` |
1a4d82fc | 18 | |
85aaf69f | 19 | needs_fn(1); |
b7449926 | 20 | //~^ ERROR expected a `std::ops::Fn<(isize,)>` closure, found `{integer}` |
1a4d82fc | 21 | } |