2015-01-08 02:53:58 +00:00
|
|
|
#![feature(box_syntax)]
|
2014-12-16 00:38:34 +00:00
|
|
|
|
2014-12-06 02:12:25 +00:00
|
|
|
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
2014-12-16 00:38:34 +00:00
|
|
|
|
|
|
|
fn main() {
|
2019-05-28 18:46:13 +00:00
|
|
|
let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
|
2015-02-23 20:27:55 +00:00
|
|
|
//~^ ERROR mismatched types
|
2019-11-14 22:08:08 +00:00
|
|
|
//~| expected unit type `()`
|
2020-09-02 07:40:56 +00:00
|
|
|
//~| found struct `Box<dyn FnOnce(isize)>`
|
2019-05-28 18:46:13 +00:00
|
|
|
let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
|
2015-01-12 06:01:44 +00:00
|
|
|
//~^ ERROR mismatched types
|
2019-11-14 22:08:08 +00:00
|
|
|
//~| expected unit type `()`
|
2020-09-02 07:40:56 +00:00
|
|
|
//~| found struct `Box<dyn Fn(isize, isize)>`
|
2019-05-28 18:46:13 +00:00
|
|
|
let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
|
2015-01-12 06:01:44 +00:00
|
|
|
//~^ ERROR mismatched types
|
2019-11-14 22:08:08 +00:00
|
|
|
//~| expected unit type `()`
|
2020-09-02 07:40:56 +00:00
|
|
|
//~| found struct `Box<dyn FnMut() -> isize>`
|
2014-12-16 00:38:34 +00:00
|
|
|
|
2015-01-31 16:23:42 +00:00
|
|
|
needs_fn(1);
|
2020-09-02 07:40:56 +00:00
|
|
|
//~^ ERROR expected a `Fn<(isize,)>` closure, found `{integer}`
|
2014-12-16 00:38:34 +00:00
|
|
|
}
|