-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
:
louy2, vermiculus and estebank
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
steveklabnik commentedon Nov 4, 2015
Triage: the error is very similar today.
steveklabnik commentedon Sep 24, 2018
Triage: no change
Rollup merge of rust-lang#62772 - estebank:trait-bound, r=matthewjasper
Rollup merge of rust-lang#62772 - estebank:trait-bound, r=matthewjasper
Rollup merge of rust-lang#62772 - estebank:trait-bound, r=matthewjasper