Skip to content

2018 edition fails to import modules for binary projects #57252

Closed
@ghost

Description

Hello Rust developers,

My project is a binary project:

├── Cargo.lock
├── Cargo.toml
├── src
    ├── a.rs
    ├── main.rs
    └── z.rs

Without edition = "2018", my imports work:

mod a;
mod z;

With edition = "2018", above imports don't work. Prefixing crate::a or self::a doesn't work either.

Error message is:

error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
  --> src/main.rs:13:5
   |
1  | mod a;
   | ------ not an extern crate passed with `--extern`

I stripped down the error message at line #13, it's just use a::something;.

I think it's a bug, may I ask if you could verify?

Thank you,

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions