-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #99903 - gimbles:pub, r=davidtwco
Add diagnostic when using public instead of pub Forwarding from #99706 I accidentally broke something(??) in git and the commits in that PR are absolutely not what I did in that branch Anyways, this is the PR for this now. Adding tests again in a minute. cc `@davidtwco`
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Checks what happens when `public` is used instead of the correct, `pub` | ||
// edition:2018 | ||
// run-rustfix | ||
pub struct X; | ||
//~^ ERROR expected one of `!` or `::`, found keyword `struct` | ||
//~^^ HELP write `pub` instead of `public` to make the item public | ||
|
||
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,8 @@ | ||
// Checks what happens when `public` is used instead of the correct, `pub` | ||
// edition:2018 | ||
// run-rustfix | ||
public struct X; | ||
//~^ ERROR expected one of `!` or `::`, found keyword `struct` | ||
//~^^ HELP write `pub` instead of `public` to make the item public | ||
|
||
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,13 @@ | ||
error: expected one of `!` or `::`, found keyword `struct` | ||
--> $DIR/public-instead-of-pub.rs:4:8 | ||
| | ||
LL | public struct X; | ||
| ^^^^^^ expected one of `!` or `::` | ||
| | ||
help: write `pub` instead of `public` to make the item public | ||
| | ||
LL | pub struct X; | ||
| ~~~ | ||
|
||
error: aborting due to previous error | ||
|