Skip to content
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

Possibly incorrect/confusing error message for E0251/E0252 when importing modules. #25396

Closed
nham opened this issue May 14, 2015 · 0 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@nham
Copy link
Contributor

nham commented May 14, 2015

I found an error message that seems a bit off to me. The code:

use foo::baz;
use bar::baz;

fn main() {}

mod foo {
    pub mod baz {}
}

mod bar {
    pub mod baz {}
}

Clearly it should fail to compile, and it does. But the error message is:

E0252_module.rs:2:5: 2:13 error: a type named `baz` has already been imported in this module [E0252]
E0252_module.rs:2 use bar::baz;
                      ^~~~~~~~

I would expect something like "a module name baz has already been imported", instead. Is it accurate to call it a type?

@nham nham changed the title Incorrect error message for E0251/E0252 when importing modules. Possibly incorrect error message for E0251/E0252 when importing modules. May 14, 2015
@nham nham changed the title Possibly incorrect error message for E0251/E0252 when importing modules. Possibly incorrect/confusing error message for E0251/E0252 when importing modules. May 14, 2015
@Aatch Aatch added the A-diagnostics Area: Messages for errors, warnings, and lints label May 22, 2015
nham pushed a commit to nham/rust that referenced this issue Jun 18, 2015
Currently in the E0252 message, traits and modules are all called types
(as in "a type named `Foo` has already been imported", even when `Foo` was
a trait or module). This commit changes that to additionally detect when
the import in question is a trait or module and report it accordingly.

Fixes rust-lang#25396.
bors added a commit that referenced this issue Jun 18, 2015
Currently in the E0252 message, traits and modules are all called types (as in "a type named `Foo` has already been imported", even when `Foo` was a trait or module). This commit changes that to additionally detect when the import in question is a trait or module and report it accordingly.

Fixes #25396.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants