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:pub_restricted.rs
14 extern crate pub_restricted;
24 pub(super) fn f(&self) {}
30 pub(self) use foo::bar::f; // ok
31 pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported
33 S::default().f(); // ok
40 use foo::bar::f; //~ ERROR private
41 S::default().x; //~ ERROR private
42 S::default().f(); //~ ERROR private
43 S::g(); //~ ERROR private
47 use pub_restricted::Universe;
48 use pub_restricted::Crate; //~ ERROR private
50 let u = Universe::default();
52 let _ = u.y; //~ ERROR private
53 let _ = u.z; //~ ERROR private
55 u.g(); //~ ERROR private
56 u.h(); //~ ERROR private
60 pub(in bad::path) mod m1 {} //~ ERROR failed to resolve. Maybe a missing `extern crate bad;`?
61 pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules