Closed
Description
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();
}