diff options
| author | yukang <moorekang@gmail.com> | 2022-08-23 17:02:40 +0800 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2022-08-23 17:02:40 +0800 |
| commit | 351acc87f57d05847e95b1863a9c5c7e953e162c (patch) | |
| tree | e778ab44ad85c2692465c8cf47b92d7849c2d7a9 /src/test | |
| parent | 38528d4dc0a0c079069764f23f11ef9f4fba2f95 (diff) | |
| download | rust-351acc87f57d05847e95b1863a9c5c7e953e162c.tar.gz rust-351acc87f57d05847e95b1863a9c5c7e953e162c.zip | |
parser will not give wrong help message for 'public'
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-1.fixed | 11 | ||||
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-1.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-1.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-2.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-2.stderr | 8 |
5 files changed, 50 insertions, 0 deletions
diff --git a/src/test/ui/parser/public-instead-of-pub-1.fixed b/src/test/ui/parser/public-instead-of-pub-1.fixed new file mode 100644 index 00000000000..a4fa68ba5cc --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-1.fixed @@ -0,0 +1,11 @@ +// Checks what happens when `public` is used instead of the correct, `pub` +// run-rustfix + +pub enum Test { + //~^ ERROR expected one of `!` or `::`, found keyword `enum` + //~^^ HELP write `pub` instead of `public` to make the item public + A, + B, +} + +fn main() { } diff --git a/src/test/ui/parser/public-instead-of-pub-1.rs b/src/test/ui/parser/public-instead-of-pub-1.rs new file mode 100644 index 00000000000..43565c9b1d2 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-1.rs @@ -0,0 +1,11 @@ +// Checks what happens when `public` is used instead of the correct, `pub` +// run-rustfix + +public enum Test { + //~^ ERROR expected one of `!` or `::`, found keyword `enum` + //~^^ HELP write `pub` instead of `public` to make the item public + A, + B, +} + +fn main() { } diff --git a/src/test/ui/parser/public-instead-of-pub-1.stderr b/src/test/ui/parser/public-instead-of-pub-1.stderr new file mode 100644 index 00000000000..795a5bcf5df --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-1.stderr @@ -0,0 +1,13 @@ +error: expected one of `!` or `::`, found keyword `enum` + --> $DIR/public-instead-of-pub-1.rs:4:8 + | +LL | public enum Test { + | ^^^^ expected one of `!` or `::` + | +help: write `pub` instead of `public` to make the item public + | +LL | pub enum Test { + | ~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/parser/public-instead-of-pub-2.rs b/src/test/ui/parser/public-instead-of-pub-2.rs new file mode 100644 index 00000000000..8a43c361e05 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-2.rs @@ -0,0 +1,7 @@ +// Checks what happens when `public` is used instead of the correct, `pub` +// Won't give help message for this case + +public let x = 1; +//~^ ERROR expected one of `!` or `::`, found keyword `let` + +fn main() { } diff --git a/src/test/ui/parser/public-instead-of-pub-2.stderr b/src/test/ui/parser/public-instead-of-pub-2.stderr new file mode 100644 index 00000000000..efe225656fd --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-2.stderr @@ -0,0 +1,8 @@ +error: expected one of `!` or `::`, found keyword `let` + --> $DIR/public-instead-of-pub-2.rs:4:8 + | +LL | public let x = 1; + | ^^^ expected one of `!` or `::` + +error: aborting due to previous error + |
