1 // Copyright 2013 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 #![feature(lang_items, start, no_std)]
12 #![no_std] // makes debugging this test *a lot* easier (during resolve)
21 // shouldn't bring in too much
22 pub use self::glob::*;
24 // can't publicly re-export private items
25 pub use self::baz::{foo, bar};
26 //~^ ERROR: function `bar` is private
28 pub use self::private::ppriv;
29 //~^ ERROR: function `ppriv` is private
44 impl B for isize { fn foo() -> isize { 3 } }
60 // both of these are re-exported by `bar`, but only one should be
61 // validly re-exported
79 self::baz::A::bar(); //~ ERROR: method `bar` is private
81 self::baz::A.bar2(); //~ ERROR: method `bar2` is private
83 // this used to cause an ICE in privacy traversal.
102 bar::A::bar(); //~ ERROR: method `bar` is private
104 bar::A.bar2(); //~ ERROR: method `bar2` is private
110 ::bar::A::bar(); //~ ERROR: method `bar` is private
112 ::bar::A.bar2(); //~ ERROR: method `bar2` is private
113 ::bar::baz::A::foo(); //~ ERROR: method `foo` is inaccessible
114 //~^ NOTE: module `baz` is private
115 ::bar::baz::A::bar(); //~ ERROR: method `bar` is private
116 ::bar::baz::A.foo2(); //~ ERROR: struct `A` is inaccessible
117 //~^ NOTE: module `baz` is private
118 ::bar::baz::A.bar2(); //~ ERROR: struct `A` is inaccessible
119 //~^ ERROR: method `bar2` is private
120 //~^^ NOTE: module `baz` is private
123 ::bar::B::foo(); //~ ERROR: method `foo` is inaccessible
124 //~^ NOTE: trait `B` is private
130 ::bar::epriv(); //~ ERROR: function `epriv` is private
139 ::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible
140 //~^ NOTE: module `baz` is private
141 ::bar::baz::bar(); //~ ERROR: function `bar` is private
145 use bar::baz::{foo, bar};
146 //~^ ERROR: function `foo` is inaccessible
147 //~^^ ERROR: function `bar` is private
154 //~^ ERROR: module `baz` is private
169 impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
170 //~^ ERROR: trait `B` is private
174 // Even though the inner `A` struct is a publicly exported item (usable from
175 // external crates through `foo::foo`, it should not be accessible through
176 // its definition path (which has the private `i` module).
177 use self::foo::i::A; //~ ERROR: type `A` is inaccessible
178 //~^ NOTE: module `i` is private
181 pub use self::i::A as foo;
189 #[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }