Skip to content

"file not found for module" compile error doesn't have an error number #39542

Closed
@frgtn

Description

@frgtn

"file not found for module" compile error does not have an error number/code, thus it cannot be easily identified/handled by external tools.

My use case is with Vim w0rp/ale plugin which does code checking as you type. It uses rustc to do "as-you-type" error checking and cargo check when a file is saved (see ale-integration-rust). Since imports cannot be resolved with "as-you-type" checking it would make sense to ignore such errors and only show them if they're detected by cargo. But since "file not found for module" doesn't have an error code I can't ignore it.

Example code src/main.rs:

mod doesnotexist;

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

When compiling I expect to get an error with an error number, something like error[E0123]: ... but no error number is provided:

$ rustc src/main.rs
error: file not found for module `doesnotexist`
 --> src/main.rs:1:5
  |
1 | mod doesnotexist;
  |     ^^^^^^^^^^^^
  |
  = help: name the file either doesnotexist.rs or doesnotexist/mod.rs inside the directory "src"
$ rustc --verbose --version
rustc 1.15.0 (10893a9a3 2017-01-19)
binary: rustc
commit-hash: 10893a9a349cdd423f2490a6984acb5b3b7c8046
commit-date: 2017-01-19
host: x86_64-apple-darwin
release: 1.15.0
LLVM version: 3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions