Skip to content

Error without location #36561

Closed
Closed
@alygin

Description

@alygin

There're two known compiler errors that provide no location information:

error: main function not found
error: aborting due to previous error

It holds true for both the standard output and the JSON error format.

While the latter is a meta error and obviously is not related to a particular place in the source code, the former one could at least come with a file name. It would be of use to both humans and IDEs, particularly when there're several executables in a single project (in the examples or src/bin folders).

Since there's always a particular file in which rustc is looking for the main() function, this file name should be mentioned in the message either with the 1:1 position, or with no position at all. This would let the user or IDE to quickly jump directly to the file in which the problem must be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-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