Skip to content

Misleading error message for "use self::submodule" when "pub mod submodule;" is in the same file #19498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mukilan opened this issue Dec 3, 2014 · 2 comments · Fixed by #19522

Comments

@mukilan
Copy link
Contributor

mukilan commented Dec 3, 2014

Example:

top.rs

use self::submodule;  // "error: unresolved import use self::submodule;"
pub mod submodule;

pub type Dummy = ();

and submodule.rs in the same directory

pub type Dummy2 = ();

The "use self::submodule" is declaring the same item name as "pub mod submodule" and should be illegal. The error message is misleading and needs to be changed.

@nrc
Copy link
Member

nrc commented Dec 4, 2014

slightly reduced test case with one file:

use self::submodule;  // "error: unresolved import use self::submodule;"
mod submodule {}

fn main() {}

@mukilan
Copy link
Contributor Author

mukilan commented Dec 4, 2014

The bug also appears when an absolute path is used to import the submodule

mod top {
    use top::submodule;  // "error: unresolved import use top::submodule;"
    mod submodule {}
}

fn main() {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants