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