Skip to content

"unresolved import" for no apparent reason. #24883

Closed
@lambdacat

Description

@lambdacat

The following code generates compiler errors which don't make sense.

mod a {
    pub mod b {
        pub struct Foo;
    }

    pub mod c {
        use super::b;

        pub struct Bar(pub b::Foo);
    }

    // Comment out this line...
    pub use self::c::*;
}

#[allow(unused_variables)]
fn main() {
    let x = a::c::Bar(a::b::Foo);

    // ...and this line, and it will compile
    let y = a::Bar(a::b::Foo);
}

Expected result: A working rust binary which does nothing.

Actual result: The following error messages:

% rustc unresolved.rs 
unresolved.rs:13:13: 13:24 error: unresolved import
unresolved.rs:13     pub use self::c::*;
                             ^~~~~~~~~~~
unresolved.rs:7:13: 7:21 error: unresolved import
unresolved.rs:7         use super::b;
                            ^~~~~~~~
error: aborting due to 2 previous errors

Meta

% rustc --version --verbose
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-unknown-linux-gnu
release: 1.0.0-beta

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