about summary refs log tree commit diff
path: root/tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.rs
blob: af35d1e0359db04c5c329636600d273c9e68982f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Regression test for <https://github.com/rust-lang/rust/issues/141419>.

use std::ops::Deref;

struct W;

trait Foo: Deref<Target = W> {
    fn method(self: &W) {}
    //~^ ERROR invalid `self` parameter type: `&W`
}

fn test(x: &dyn Foo) {
    //~^ ERROR the trait `Foo` is not dyn compatible
    x.method();
    //~^ ERROR the trait `Foo` is not dyn compatible
}

fn main() {}