Skip to content
Browse files

clean up E0185 explanation

  • Loading branch information
GuillaumeGomez committed Jan 9, 2020
1 parent ee84c30 commit f79ba857dd1271ea8d5207121c2487621ebc23dd
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/librustc_error_codes/error_codes/
@@ -2,7 +2,7 @@ An associated function for a trait was defined to be static, but an
implementation of the trait declared the same function to be a method (i.e., to
take a `self` parameter).

Here's an example of this error:
Erroneous code example:

trait Foo {
@@ -17,3 +17,19 @@ impl Foo for Bar {
fn foo(&self) {}

When a type implements a trait's associated function, it has to use the same
signature. So in this case, since `Foo::foo` doesn't take argument and doesn't
return anything, its implementation on `Bar` should the same:

trait Foo {
fn foo();
struct Bar;
impl Foo for Bar {
fn foo() {} // ok!

0 comments on commit f79ba85

Please sign in to comment.
You can’t perform that action at this time.