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

"unresolved import" for no apparent reason. #24883

Closed
lambdacat opened this issue Apr 28, 2015 · 2 comments · Fixed by #32850
Closed

"unresolved import" for no apparent reason. #24883

lambdacat opened this issue Apr 28, 2015 · 2 comments · Fixed by #32850
Labels
A-resolve Area: Path resolution

Comments

@lambdacat
Copy link

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
@retep998
Copy link
Member

Possible dupe of #4865 or #18083

@steveklabnik steveklabnik added the A-resolve Area: Path resolution label Apr 28, 2015
@jseyfried
Copy link
Contributor

This was fixed in #27439, which included a regression test similar to the example for this issue.
cc @steveklabnik

jseyfried added a commit to jseyfried/rust that referenced this issue Apr 9, 2016
Manishearth added a commit to Manishearth/rust that referenced this issue Apr 10, 2016
resolve: Add regression tests for fixed issues

This adds regression tests for fixed issues in resolve (closes rust-lang#22146, closes rust-lang#24883, closes rust-lang#26930).
r? @eddyb
bors added a commit that referenced this issue Apr 11, 2016
resolve: Add regression tests for fixed issues

This adds regression tests for fixed issues in resolve (closes #22146, closes #24883, closes #26930).
r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants