Skip to content

Improve compiler help for missing module error (E0583) #84819

Closed
@Zerotask

Description

@Zerotask

I created a fresh project with cargo init, a new empty folder user
image

and my main.rs looks as following:

mod user;

fn main() {
    println!("Hello, world!");
}

If I execute cargo run, the compiler gives me the help:
image

Since I created a folder user the compiler could also suggest adding a src\user\mod.rs.

My suggested help for this case would be:

= help: to create the module `user`, create file "src\user.rs" or "src\user\mod.rs"

The compiler could always show this help, not only if there is a folder with that name.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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