Rollup merge of #99903 - gimbles:pub, r=davidtwco
Add diagnostic when using public instead of pub Forwarding from https://github.com/rust-lang/rust/pull/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`
This commit is contained in:
commit
df2cf97830
4 changed files with 40 additions and 0 deletions
8
src/test/ui/parser/public-instead-of-pub.fixed
Normal file
8
src/test/ui/parser/public-instead-of-pub.fixed
Normal file
|
|
@ -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() {}
|
||||
8
src/test/ui/parser/public-instead-of-pub.rs
Normal file
8
src/test/ui/parser/public-instead-of-pub.rs
Normal file
|
|
@ -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() {}
|
||||
13
src/test/ui/parser/public-instead-of-pub.stderr
Normal file
13
src/test/ui/parser/public-instead-of-pub.stderr
Normal file
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue