Closed
Description
trait Foo { fn method(&self) {} }
fn call_method<T>(x: &T) {
x.method()
}
fn main() {}
error[E0599]: no method named `method` found for type `&T` in the current scope
--> src/main.rs:4:7
|
4 | x.method()
| ^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `method`, perhaps you need to implement it:
candidate #1: `Foo`
but the long help would be better as something like:
methods from traits can only be called if the the type parameter is bounded those traits; the following trait defines a method
method
: