2019-07-26 21:54:25 +00:00
|
|
|
//@ run-pass
|
2024-03-11 01:18:41 +00:00
|
|
|
//@ revisions: current next
|
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2023-12-14 12:11:28 +00:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
2019-07-26 21:54:25 +00:00
|
|
|
|
2018-11-04 04:47:10 +00:00
|
|
|
trait Foo: Fn(i32) -> i32 + Send {}
|
2018-10-12 00:50:03 +00:00
|
|
|
|
2018-11-04 04:47:10 +00:00
|
|
|
impl<T: ?Sized + Fn(i32) -> i32 + Send> Foo for T {}
|
2018-10-12 00:50:03 +00:00
|
|
|
|
2019-05-28 18:47:21 +00:00
|
|
|
fn wants_foo(f: Box<dyn Foo>) -> i32 {
|
2018-11-04 04:47:10 +00:00
|
|
|
f(42)
|
|
|
|
}
|
2018-10-25 00:03:25 +00:00
|
|
|
|
2018-11-04 04:47:10 +00:00
|
|
|
fn main() {
|
|
|
|
let f = Box::new(|x| x);
|
|
|
|
assert_eq!(wants_foo(f), 42);
|
2018-10-12 00:50:03 +00:00
|
|
|
}
|