forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#101668 - chenyukang:fix-101626, r=TaKO8Ki
Suggest pub instead of public for const type item Fixes rust-lang#101626
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -473,6 +473,7 @@ impl Token { | |
kw::Extern, | ||
kw::Impl, | ||
kw::Unsafe, | ||
kw::Const, | ||
kw::Static, | ||
kw::Union, | ||
kw::Macro, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|