Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing semicolon suggestion for global variable declarations #100533

Closed
Rageking8 opened this issue Aug 14, 2022 · 1 comment · Fixed by #100565
Closed

Add missing semicolon suggestion for global variable declarations #100533

Rageking8 opened this issue Aug 14, 2022 · 1 comment · Fixed by #100565
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Rageking8
Copy link
Contributor

Rageking8 commented Aug 14, 2022

Given the following code: link

const x: i32 = 123

fn main() {

}

The current output is:

   Compiling playground v0.0.1 (/playground)
error: expected one of `.`, `;`, `?`, or an operator, found keyword `fn`
 --> src/main.rs:3:1
  |
1 | const x: i32 = 123
  |                   - expected one of `.`, `;`, `?`, or an operator
2 |
3 | fn main() {
  | ^^ unexpected token

error: could not compile `playground` due to previous error

Ideally the output should suggest putting a semicolon at the end of the declaration, since that suggestion is present if that declaration is placed in the main function.

@Rageking8 Rageking8 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 14, 2022
@chenyukang
Copy link
Member

@rustbot claim

@chenyukang chenyukang removed their assignment Aug 14, 2022
@TaKO8Ki TaKO8Ki self-assigned this Aug 15, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 23, 2022
…icolon-before-item, r=compiler-errors

Suggest adding a missing semicolon before an item

fixes rust-lang#100533
@bors bors closed this as completed in 54d0f50 Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants