Pre-RFC: privately imported names should be visible to submodules

Isn’t that more ergonomic and intuitive? Example:

mod outer {
  pub mod m {
    pub type X = i32;
  }

  use self::m::X;
  type Y = X;

  type Z = i32;

  mod n {
    use super::X;  // NG
    type P = X;

    use super::Y;  // OK
    type Q = Y;
 
    use super::Z;  // OK
    type R = Z;
  }
}

As of now, we must either change use to pub use or change super::X to super::m::X. The former breaks modularity (I don’t necessarily want to expose X to an user of outer) and the latter almost ignores the raison d’etre of importing.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.