diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-10-18 13:00:14 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-10-18 13:00:14 -0700 |
| commit | 2b76c8b95ff866d8806fdc82fe270c4df02efc0b (patch) | |
| tree | 7c74a8df5e356164b74e19c6c7e7dc7a3d2d008d /src | |
| parent | bd813bf1acbef7643a06278af48603397c7eb5c5 (diff) | |
| download | rust-2b76c8b95ff866d8806fdc82fe270c4df02efc0b.tar.gz rust-2b76c8b95ff866d8806fdc82fe270c4df02efc0b.zip | |
review comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_resolve/error_codes.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc_resolve/error_codes.rs b/src/librustc_resolve/error_codes.rs index ee207025e0c..2288aab3c27 100644 --- a/src/librustc_resolve/error_codes.rs +++ b/src/librustc_resolve/error_codes.rs @@ -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: @@ -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: |
