about summary refs log tree commit diff
path: root/tests/ui/suggestions/impl-trait-with-missing-trait-bounds-in-arg.rs
blob: f49512bdd62af7abc8d714bec4049bca79261dc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//@ run-rustfix

trait Foo {}

trait Bar {
    fn hello(&self) {}
}

struct S;

impl Foo for S {}
impl Bar for S {}

fn test(foo: impl Foo) {
    foo.hello(); //~ ERROR no method named `hello` found
}

trait Trait {
    fn method(&self) {}
}

impl Trait for fn() {}

#[allow(dead_code)]
fn test2(f: impl Fn() -> dyn std::fmt::Debug) {
    f.method(); //~ ERROR no method named `method` found
}

fn main() {
    test(S);
}