Skip to content

Improve output when rustc couldn't find the source code file (suggest typo, improve wording) #156070

@estebank

Description

@estebank

When running rustc fo.rs, the current output is

error: couldn't read `fo.rs`: No such file or directory (os error 2)

First of all, for the case where the compiler couldn't find the file, we should skip the (os error 2) and should be closer to

error: couldn't find file  `fo.rs`

There are other cases (like the file exists but the user doesn't have the appropriate permissions) that should also have better wording instead of relying on the error's wording. (This will quickly run into diminishing returns, of course.)

But ideally, we should also go the extra mile and look for typos:

error: couldn't find file  `fo.rs`
  = help: you might have meant to open `foo.rs`: `rustc foo.rs`

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions