fix #101626, suggest pub instead of public for const type item
This commit is contained in:
parent
4a6ac3c225
commit
975dd6cdea
@ -473,6 +473,7 @@ pub fn can_begin_item(&self) -> bool {
|
||||
kw::Extern,
|
||||
kw::Impl,
|
||||
kw::Unsafe,
|
||||
kw::Const,
|
||||
kw::Static,
|
||||
kw::Union,
|
||||
kw::Macro,
|
||||
|
9
src/test/ui/parser/public-instead-of-pub-3.fixed
Normal file
9
src/test/ui/parser/public-instead-of-pub-3.fixed
Normal file
@ -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);
|
||||
}
|
9
src/test/ui/parser/public-instead-of-pub-3.rs
Normal file
9
src/test/ui/parser/public-instead-of-pub-3.rs
Normal file
@ -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);
|
||||
}
|
13
src/test/ui/parser/public-instead-of-pub-3.stderr
Normal file
13
src/test/ui/parser/public-instead-of-pub-3.stderr
Normal file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user