about summary refs log tree commit diff
path: root/tests/ui/closures/deduce-from-object-supertrait.rs
blob: aff750dc62ea3e1fdf590622720adf58aa693a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//@ check-pass

// This test checks that we look at consider the super traits of trait objects
// when deducing closure signatures.

trait Foo: Fn(Bar) {}
impl<T> Foo for T where T: Fn(Bar) {}

struct Bar;
impl Bar {
    fn bar(&self) {}
}

fn main() {
    let x: &dyn Foo = &|x| {
        x.bar();
    };
}