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 reach private modules through public modules from outside the crate #7388

Closed
SiegeLord opened this issue Jun 25, 2013 · 3 comments
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@SiegeLord
Copy link
Contributor

rustc version:

rustc 0.6 (dc4560d 2013-06-21 19:19:58 -0700)
host: x86_64-unknown-linux-gnu

Given two crates, crate1.rs and crate2.rs, I can access a private module within crate2.rs through a public module.

crate1.rs:

extern mod crate2;

fn main()
{
    crate2::public::private::foo(); // Works but shouldn't
    // crate2::private::foo(); // Correctly gives the error
} 

crate2.rs:

#[crate_type = "lib"];

pub mod public
{
    mod private
    {
        pub fn foo() { }
    }
}

mod private
{
    pub fn foo() { }
}

fn bar()
{
    // Both of these work since they are intra-crate
    public::private::foo();
    private::foo();
}
@sonwow
Copy link
Contributor

sonwow commented Aug 13, 2013

Now it seems to work well.

rustc version :

rustc 0.8-pre (59da4e0 2013-08-12 15:28:49 -0700)
host: x86_64-unknown-linux-gnu

@klutzy
Copy link
Contributor

klutzy commented Sep 25, 2013

This led me even linker error (revision d7bb40c), but it is now fixed by #9432.

@alexcrichton
Copy link
Member

hurray! (there are tests for this already, so closing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants