rust/src/test/ui/issues/issue-24010.rs

15 lines
233 B
Rust
Raw Normal View History

// run-pass
2018-11-04 04:47:10 +00:00
trait Foo: Fn(i32) -> i32 + Send {}
2018-11-04 04:47:10 +00:00
impl<T: ?Sized + Fn(i32) -> i32 + Send> Foo for T {}
2019-05-28 14:47:21 -04:00
fn wants_foo(f: Box<dyn Foo>) -> i32 {
2018-11-04 04:47:10 +00:00
f(42)
}
2018-10-25 01:03:25 +01:00
2018-11-04 04:47:10 +00:00
fn main() {
let f = Box::new(|x| x);
assert_eq!(wants_foo(f), 42);
}