summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/issue-24010.rs
blob: f1818533487f61c0d2cefce10cb54a41b8c200cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// run-pass

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);
}