Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trait suggestions for type parameters should suggest using the traits as bounds #21673

Open
huonw opened this issue Jan 26, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@huonw
Copy link
Member

commented Jan 26, 2015

trait Foo { fn method(&self) {} }

fn call_method<T>(x: &T) {
    x.method()
}

fn main() {}

currently gives

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:

@steveklabnik

This comment has been minimized.

Copy link
Member

commented Nov 4, 2015

Triage: the error is very similar today.

@steveklabnik

This comment has been minimized.

Copy link
Member

commented Sep 24, 2018

Triage: no change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.