Skip to content

Commit d7bad03

Browse files
authored
Rollup merge of rust-lang#101668 - chenyukang:fix-101626, r=TaKO8Ki
Suggest pub instead of public for const type item Fixes rust-lang#101626
2 parents 9317775 + 975dd6c commit d7bad03

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

compiler/rustc_ast/src/token.rs

+1
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ impl Token {
473473
kw::Extern,
474474
kw::Impl,
475475
kw::Unsafe,
476+
kw::Const,
476477
kw::Static,
477478
kw::Union,
478479
kw::Macro,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// run-rustfix
2+
mod test {
3+
pub const X: i32 = 123;
4+
//~^ ERROR expected one of `!` or `::`, found keyword `const`
5+
}
6+
7+
fn main() {
8+
println!("{}", test::X);
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// run-rustfix
2+
mod test {
3+
public const X: i32 = 123;
4+
//~^ ERROR expected one of `!` or `::`, found keyword `const`
5+
}
6+
7+
fn main() {
8+
println!("{}", test::X);
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: expected one of `!` or `::`, found keyword `const`
2+
--> $DIR/public-instead-of-pub-3.rs:3:12
3+
|
4+
LL | public const X: i32 = 123;
5+
| ^^^^^ expected one of `!` or `::`
6+
|
7+
help: write `pub` instead of `public` to make the item public
8+
|
9+
LL | pub const X: i32 = 123;
10+
| ~~~
11+
12+
error: aborting due to previous error
13+

0 commit comments

Comments
 (0)