forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#91798 - bugadani:issue-91783, r=michaelwoer…
…ister Avoid suggest adding `self` in visibility spec Fixes rust-lang#91783
- Loading branch information
Showing
3 changed files
with
50 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
struct X(i32); | ||
|
||
impl X { | ||
pub(crate) fn f() { | ||
self.0 | ||
//~^ ERROR expected value, found module `self` | ||
} | ||
|
||
pub fn g() { | ||
self.0 | ||
//~^ ERROR expected value, found module `self` | ||
} | ||
} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
error[E0424]: expected value, found module `self` | ||
--> $DIR/suggest-add-self.rs:5:9 | ||
| | ||
LL | pub(crate) fn f() { | ||
| - this function doesn't have a `self` parameter | ||
LL | self.0 | ||
| ^^^^ `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 | pub(crate) fn f(&self) { | ||
| +++++ | ||
|
||
error[E0424]: expected value, found module `self` | ||
--> $DIR/suggest-add-self.rs:10:9 | ||
| | ||
LL | pub fn g() { | ||
| - this function doesn't have a `self` parameter | ||
LL | self.0 | ||
| ^^^^ `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 | pub fn g(&self) { | ||
| +++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0424`. |