Misleading E0583 when attempting to compile a file that includes itself as a module #70545
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
If we have any file
aaa.rs
andexample.rs
in the same directory, whereexample.rs
contains:Compiling
example.rs
withrustc example.rs
gives an error about being unable to findaaa
, rather than an error aboutexample.rs
importing itself as a module:The error message with
rustc +nightly
.I expected to see this happen:
rustc
give an error aboutmod example;
inexample.rs
.Instead, this happened:
rustc
gave an error about not being able to find the first import in the file relative toexample.rs
as a module.The error messages are a little bit better on nightly, but still misleading.
Shell script to reproduce the issue.
Meta
rustc --version --verbose
:rustc +nightly --version --verbose
:The error messages are the same with
RUST_BACKTRACE=1
on the stable and nightly compilers.The text was updated successfully, but these errors were encountered: