2017-01-08 15:21:35 -06:00
|
|
|
// aux-build:privacy-struct-ctor.rs
|
|
|
|
|
|
|
|
extern crate privacy_struct_ctor as xcrate;
|
|
|
|
|
|
|
|
mod m {
|
|
|
|
pub struct S(u8);
|
2018-01-01 17:29:50 -06:00
|
|
|
pub struct S2 {
|
|
|
|
s: u8
|
|
|
|
}
|
2017-01-08 15:21:35 -06:00
|
|
|
|
|
|
|
pub mod n {
|
2017-03-07 17:50:13 -06:00
|
|
|
pub(in m) struct Z(pub(in m::n) u8);
|
2017-01-08 15:21:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
use m::n::Z; // OK, only the type is imported
|
|
|
|
|
|
|
|
fn f() {
|
2018-01-15 07:18:06 -06:00
|
|
|
n::Z;
|
2019-10-11 09:38:20 -05:00
|
|
|
//~^ ERROR tuple struct constructor `Z` is private
|
2017-01-28 17:56:52 -06:00
|
|
|
Z;
|
|
|
|
//~^ ERROR expected value, found struct `Z`
|
2017-01-08 15:21:35 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
use m::S; // OK, only the type is imported
|
2018-01-01 17:29:50 -06:00
|
|
|
use m::S2; // OK, only the type is imported
|
2017-01-08 15:21:35 -06:00
|
|
|
|
|
|
|
fn main() {
|
2018-01-15 07:18:06 -06:00
|
|
|
m::S;
|
2019-10-11 09:38:20 -05:00
|
|
|
//~^ ERROR tuple struct constructor `S` is private
|
2018-01-15 07:18:06 -06:00
|
|
|
let _: S = m::S(2);
|
2019-10-11 09:38:20 -05:00
|
|
|
//~^ ERROR tuple struct constructor `S` is private
|
2017-01-28 17:56:52 -06:00
|
|
|
S;
|
|
|
|
//~^ ERROR expected value, found struct `S`
|
2018-01-15 07:18:06 -06:00
|
|
|
m::n::Z;
|
2019-10-11 09:38:20 -05:00
|
|
|
//~^ ERROR tuple struct constructor `Z` is private
|
2017-01-08 15:21:35 -06:00
|
|
|
|
2018-01-01 17:29:50 -06:00
|
|
|
S2;
|
|
|
|
//~^ ERROR expected value, found struct `S2`
|
|
|
|
|
2018-01-15 07:18:06 -06:00
|
|
|
xcrate::m::S;
|
2019-10-11 09:38:20 -05:00
|
|
|
//~^ ERROR tuple struct constructor `S` is private
|
2017-01-28 17:56:52 -06:00
|
|
|
xcrate::S;
|
|
|
|
//~^ ERROR expected value, found struct `xcrate::S`
|
2018-01-15 07:18:06 -06:00
|
|
|
xcrate::m::n::Z;
|
2019-10-11 09:38:20 -05:00
|
|
|
//~^ ERROR tuple struct constructor `Z` is private
|
2017-01-08 15:21:35 -06:00
|
|
|
}
|