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

Wrong diagnostic: main function not found in crate #124935

Closed
dev-ardi opened this issue May 9, 2024 · 5 comments · Fixed by #125276
Closed

Wrong diagnostic: main function not found in crate #124935

dev-ardi opened this issue May 9, 2024 · 5 comments · Fixed by #125276
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dev-ardi
Copy link
Contributor

dev-ardi commented May 9, 2024

Tested on nightly and stable.

;
fn main() { }
error: expected item, found `;`
 --> src/main.rs:1:1
  |
1 | ;
  | ^ help: remove this semicolon

error[E0601]: `main` function not found in crate `tests`
 --> src/main.rs:1:2
  |
1 | ;
  |  ^ consider adding a `main` function to `src/main.rs`

For more information about this error, try `rustc --explain E0601`.
error: could not compile `tests` (bin "tests") due to 2 previous errors

The second diagnostic is strange.

@dev-ardi dev-ardi added the C-bug Category: This is a bug. label May 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 9, 2024
@dev-ardi
Copy link
Contributor Author

dev-ardi commented May 9, 2024

@rustbot label +A-diagnostics S-has-mvce

@saethlin saethlin added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue A-diagnostics Area: Messages for errors, warnings, and lints and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 10, 2024
@gurry
Copy link
Contributor

gurry commented May 11, 2024

@rustbot claim

@dev-ardi
Copy link
Contributor Author

@saethlin any idea why rustbot ignored me?

@saethlin
Copy link
Member

Just guessing, the missing + for S-has-mcve maybe?

@clubby789 clubby789 added the A-parser Area: The parsing of Rust source code to an AST. label May 13, 2024
@bors bors closed this as completed in f9bf759 May 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 18, 2024
Rollup merge of rust-lang#125117 - dev-ardi:improve-parser, r=wesleywiser,fmease

Improve parser

Fixes rust-lang#124935.

- Add a few more help diagnostics to incorrect semicolons
- Overall improved that function
- Addded a few comments
- Renamed diff_marker fns to git_diff_marker
@fmease
Copy link
Member

fmease commented May 19, 2024

Oops, this should'nt've been closed.

@fmease fmease reopened this May 19, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 21, 2024
Fix parsing of erroneously placed semicolons

This closes rust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117.

Thanks `@gurry` for your code and sorry for making it confusing :P

r? fmease
fmease added a commit to fmease/rust that referenced this issue May 21, 2024
Fix parsing of erroneously placed semicolons

This closes rust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117.

Thanks ``@gurry`` for your code and sorry for making it confusing :P

r? fmease
@bors bors closed this as completed in bfa98d3 May 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 21, 2024
Rollup merge of rust-lang#125276 - dev-ardi:no-main-diag, r=fmease

Fix parsing of erroneously placed semicolons

This closes rust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117.

Thanks ```@gurry``` for your code and sorry for making it confusing :P

r? fmease
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 A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
6 participants