rust/tests/ui/traits/issue-24010.rs
2023-12-14 15:22:37 +01:00

17 lines
298 B
Rust

// run-pass
// revisions: classic next
//[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);
}