diff options
| author | yukang <moorekang@gmail.com> | 2022-09-11 08:29:38 +0800 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2022-09-11 08:29:38 +0800 |
| commit | 975dd6cdea09253f4f3ae0e5c4217ea2cc2d5319 (patch) | |
| tree | cf3ac210329060e34687b057b0591867bb874e95 /src/test/ui/parser | |
| parent | 4a6ac3c225d6322caaf0ef86623cddc74e5260c6 (diff) | |
fix #101626, suggest pub instead of public for const type item
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-3.fixed | 9 | ||||
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-3.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/parser/public-instead-of-pub-3.stderr | 13 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/parser/public-instead-of-pub-3.fixed b/src/test/ui/parser/public-instead-of-pub-3.fixed new file mode 100644 index 00000000000..14f620f41e8 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-3.fixed @@ -0,0 +1,9 @@ +// run-rustfix +mod test { + pub const X: i32 = 123; + //~^ ERROR expected one of `!` or `::`, found keyword `const` +} + +fn main() { + println!("{}", test::X); +} diff --git a/src/test/ui/parser/public-instead-of-pub-3.rs b/src/test/ui/parser/public-instead-of-pub-3.rs new file mode 100644 index 00000000000..ee27cb1a1a8 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-3.rs @@ -0,0 +1,9 @@ +// run-rustfix +mod test { + public const X: i32 = 123; + //~^ ERROR expected one of `!` or `::`, found keyword `const` +} + +fn main() { + println!("{}", test::X); +} diff --git a/src/test/ui/parser/public-instead-of-pub-3.stderr b/src/test/ui/parser/public-instead-of-pub-3.stderr new file mode 100644 index 00000000000..72efae08dda --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-3.stderr @@ -0,0 +1,13 @@ +error: expected one of `!` or `::`, found keyword `const` + --> $DIR/public-instead-of-pub-3.rs:3:12 + | +LL | public const X: i32 = 123; + | ^^^^^ expected one of `!` or `::` + | +help: write `pub` instead of `public` to make the item public + | +LL | pub const X: i32 = 123; + | ~~~ + +error: aborting due to previous error + |
