Account for arbitrary self types in E0599

This commit is contained in:
Esteban Küber 2020-02-19 15:57:21 -08:00
parent 392d853589
commit 01286408c1
4 changed files with 60 additions and 17 deletions

View file

@ -1,13 +1,11 @@
error[E0599]: no method named `foo` found for reference `&dyn Foo` in the current scope
--> $DIR/issue-5153.rs:10:27
|
LL | trait Foo {
| --------- `Foo` defines an item `foo`, perhaps you need to implement it
LL | fn foo(self: Box<Self>);
| --------- the method might not be found because of this arbitrary self type
...
LL | (&5isize as &dyn Foo).foo();
| ^^^ method not found in `&dyn Foo`
|
= help: items from traits can only be used if the trait is implemented and in scope
error: aborting due to previous error