Closed
Description
mod m1 {
struct A;
pub fn x() -> A { A }
}
fn main() {
let x=m1::x();
println!("{:?}",&x as *const _ as *const u8);
}
This generates an error:
<anon>:3:16: 3:17 error: private type in exported type signature [E0446]
<anon>:3 pub fn x() -> A { A }
^
Yet this compiles fine:
mod m1 {
mod m2 { pub struct A; }
use self::m2::A as A;
pub fn x() -> A { A }
}
fn main() {
let x=m1::x();
println!("{:?}",&x as *const _ as *const u8);
}
However, one is unable to specify the return type of m1::x()
outside of m1
.