1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // aux-build:privacy-struct-ctor.rs
13 #![feature(pub_restricted)]
15 extern crate privacy_struct_ctor as xcrate;
21 pub(m) struct Z(pub(m::n) u8);
24 use m::n::Z; // OK, only the type is imported
27 n::Z; //~ ERROR tuple struct `Z` is private
29 //~^ ERROR expected value, found struct `Z`
30 //~| NOTE tuple struct constructors with private fields are invisible outside of their mod
34 use m::S; // OK, only the type is imported
37 m::S; //~ ERROR tuple struct `S` is private
39 //~^ ERROR expected value, found struct `S`
40 //~| NOTE constructor is not visible here due to private fields
41 m::n::Z; //~ ERROR tuple struct `Z` is private
43 xcrate::m::S; //~ ERROR tuple struct `S` is private
45 //~^ ERROR expected value, found struct `xcrate::S`
46 //~| NOTE constructor is not visible here due to private fields
47 xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private