mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +00:00
17 lines
304 B
Rust
17 lines
304 B
Rust
// run-pass
|
|
// revisions: classic next
|
|
//[next] compile-flags: -Ztrait-solver=next
|
|
|
|
trait Foo: Fn(i32) -> i32 + Send {}
|
|
|
|
impl<T: ?Sized + Fn(i32) -> i32 + Send> Foo for T {}
|
|
|
|
fn wants_foo(f: Box<dyn Foo>) -> i32 {
|
|
f(42)
|
|
}
|
|
|
|
fn main() {
|
|
let f = Box::new(|x| x);
|
|
assert_eq!(wants_foo(f), 42);
|
|
}
|