Skip to content

Wrong diagnostic: main function not found in crate #124935

Closed
@oriongonza

Description

@oriongonza

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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions