Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Oct 18, 2019
1 parent bd813bf commit 2b76c8b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/librustc_resolve/error_codes.rs
Expand Up @@ -1014,11 +1014,7 @@ fn h1() -> i32 {

E0424: r##"
The `self` keyword was used inside of an associated function without a "`self`
receiver" parameter. The `self` keyword can only be used inside methods, which
are associated functions (functions defined inside of a `trait` or `impl` block)
that have a `self` receiver as its first parameter, like `self`, `&self`,
`&mut self` or `self: &mut Pin<Self>` (this last one is an example of an
["abitrary `self` type"](https://github.com/rust-lang/rust/issues/44874)).
receiver" parameter.
Erroneous code example:
Expand All @@ -1037,6 +1033,12 @@ impl Foo {
}
```
The `self` keyword can only be used inside methods, which are associated
functions (functions defined inside of a `trait` or `impl` block) that have a
`self` receiver as its first parameter, like `self`, `&self`, `&mut self` or
`self: &mut Pin<Self>` (this last one is an example of an ["abitrary `self`
type"](https://github.com/rust-lang/rust/issues/44874)).
Check if the associated function's parameter list should have contained a `self`
receiver for it to be a method, and add it if so. Example:
Expand Down

0 comments on commit 2b76c8b

Please sign in to comment.