mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
18 lines
358 B
Rust
18 lines
358 B
Rust
//@ run-pass
|
|
//@ revisions: current next
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
|
//@[next] compile-flags: -Znext-solver
|
|
|
|
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);
|
|
}
|