-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest adding
&self
when accessing self
in static assoc fn
- Loading branch information
Showing
5 changed files
with
98 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
error[E0424]: expected value, found module `self` | ||
--> $DIR/E0424.rs:7:9 | ||
| | ||
LL | / fn foo() { | ||
LL | | self.bar(); | ||
| | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | ||
LL | | } | ||
| |_____- this function doesn't have a `self` parameter | ||
LL | fn foo() { | ||
| --- this function doesn't have a `self` parameter | ||
LL | self.bar(); | ||
| ^^^^ `self` value is a keyword only available in methods with a `self` parameter | ||
| | ||
help: add a `self` receiver parameter to make the associated `fn` a method | ||
| | ||
LL | fn foo(&self) { | ||
| ^^^^^ | ||
|
||
error[E0424]: expected value, found module `self` | ||
--> $DIR/E0424.rs:11:9 | ||
| | ||
LL | fn baz(_: i32) { | ||
| --- this function doesn't have a `self` parameter | ||
LL | self.bar(); | ||
| ^^^^ `self` value is a keyword only available in methods with a `self` parameter | ||
| | ||
help: add a `self` receiver parameter to make the associated `fn` a method | ||
| | ||
LL | fn baz(&self, _: i32) { | ||
| ^^^^^^ | ||
|
||
error[E0424]: expected unit struct, unit variant or constant, found module `self` | ||
--> $DIR/E0424.rs:12:9 | ||
--> $DIR/E0424.rs:16:9 | ||
| | ||
LL | / fn main () { | ||
LL | | let self = "self"; | ||
| | ^^^^ `self` value is a keyword and may not be bound to variables or shadowed | ||
LL | | } | ||
| |_- this function doesn't have a `self` parameter | ||
LL | fn main () { | ||
| ---- this function can't have a `self` parameter | ||
LL | let self = "self"; | ||
| ^^^^ `self` value is a keyword and may not be bound to variables or shadowed | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0424`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters