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

Can't bring nested mod into scope with use foo::foo #5130

Closed
ben0x539 opened this issue Feb 27, 2013 · 2 comments
Closed

Can't bring nested mod into scope with use foo::foo #5130

ben0x539 opened this issue Feb 27, 2013 · 2 comments
Labels
A-resolve Area: Name resolution

Comments

@ben0x539
Copy link
Contributor

The use foo::foo; line seems to do nothing at all, the reference to foo inside main still seems to resolve to the outer foo.

    mod foo {
        pub mod foo {
            pub fn f() {}
        }
    }

    use foo::foo;

    fn main() {
        foo::f();
    }
hw.rs:10:4: 10:10 error: unresolved name: foo::f
hw.rs:10     foo::f();
             ^~~~~~

Should the use item just be illegal if it collides with an existing name? This issue confused me for quite a while with the rust-sdl package's sdl crate that contains an sdl mod.

@catamorphism
Copy link
Contributor

Seems non-critical for 0.7. Nominating for milestone #1 (well-defined).

@graydon
Copy link
Contributor

graydon commented May 2, 2013

This is an "expected no-shadowing, got shadowing" case. it now rejects at parse level because the use things must come first. (This is actually the case that rule was introduced to handle).

@graydon graydon closed this as completed May 2, 2013
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2020
…1995

Split up `indexing_slicing` ui test

Closes rust-lang#2038

Now all the stderrs are less than 200 lines 🎉

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution
Projects
None yet
Development

No branches or pull requests

3 participants