about summary refs log tree commit diff
path: root/tests/ui/self/invalid-self-dyn-receiver.rs
blob: a989b331b5e0b6fb15ca72384e8078e4e770b204 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Makes sure we don't ICE when encountering a receiver that is *ostensibly* dyn safe,
// because it satisfies `&dyn Bar: DispatchFromDyn<&dyn Bar>`, but is not a valid receiver
// in wfcheck.

#![feature(arbitrary_self_types)]

use std::ops::Deref;

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

trait Bar {}

fn test(x: &dyn Foo) {
     x.method();
}

fn main() {}