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