Closed
Description
trait Foo {}
trait Bar {
fn hello(&mut self) {}
}
fn test(foo: &mut impl Foo) {
foo.hello();
}
rustc outputs:
error[E0599]: no method named `hello` found for type `&mut impl Foo` in the current scope
--> src/lib.rs:8:9
|
8 | foo.hello();
| ^^^^^
|
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `hello`, perhaps you need to restrict type parameter `impl Foo` with it:
|
7 | fn test(foo: &mut impl Foo: Bar + {
| ^^^^^^^^^^^^^^^