Skip to content

nightly regression: ambiguous import  #57539

Description

@rukai

main.rs

mod foo {
    mod simple_command {
        use simple_command;
        use crate::foo::*;
    }
}

mod bar {
}

fn main() {
}

cargo.toml

[package]
name = "foo"
version = "0.1.0"
authors = ["Rukai <rubickent@gmail.com>"]
edition = "2018"

[dependencies]
simple_command = "0.1"

On stable and nightly-2018-12-29 the code compiles successfully.
On nightly-2019-01-01 the code fails to compile with:

rubic@memes src$ cargo run
   Compiling foo v0.1.0 (/home/rubic/Foo/foo)
error[E0659]: `simple_command` is ambiguous (name vs any other name during import resolution)
 --> src/main.rs:3:13
  |
3 |         use simple_command;
  |             ^^^^^^^^^^^^^^ ambiguous name
  |
  = note: `simple_command` could refer to an extern crate passed with `--extern`
  = help: use `::simple_command` to refer to this extern crate unambiguously
note: `simple_command` could also refer to the module imported here
 --> src/main.rs:4:13
  |
4 |         use crate::foo::*;
  |             ^^^^^^^^^^^^^
  = help: use `self::simple_command` to refer to this module unambiguously

warning: unused import: `simple_command`
 --> src/main.rs:3:13
  |
3 |         use simple_command;
  |             ^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

error: aborting due to previous error

For more information about this error, try `rustc --explain E0659`.
error: Could not compile `foo`.

At first I thought this was part of #56316
but now I think it is different because it started happening on nightly-2019-01-01 whereas that issue is from November.

This is currently causing ggez to fail to compile on nightly: ggez/ggez#542

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions