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.
12 #![no_std] // makes debugging this test *a lot* easier (during resolve)
15 // shouln't bring in too much
16 pub use self::glob::*;
18 // can't publicly re-export private items
19 pub use self::baz::{foo, bar};
20 //~^ ERROR: function `bar` is private
22 pub use self::private::ppriv;
23 //~^ ERROR: function `ppriv` is private
38 impl B for int { fn foo() -> int { 3 } }
55 // both of these are re-exported by `bar`, but only one should be
56 // validly re-exported
75 self::baz::A::bar(); //~ ERROR: method `bar` is private
77 self::baz::A.bar2(); //~ ERROR: method `bar2` is private
79 // this used to cause an ICE in privacy traversal.
98 bar::A::bar(); //~ ERROR: method `bar` is private
100 bar::A.bar2(); //~ ERROR: method `bar2` is private
106 ::bar::A::bar(); //~ ERROR: method `bar` is private
108 ::bar::A.bar2(); //~ ERROR: method `bar2` is private
109 ::bar::baz::A::foo(); //~ ERROR: method `foo` is inaccessible
110 //~^ NOTE: module `baz` is private
111 ::bar::baz::A::bar(); //~ ERROR: method `bar` is private
112 ::bar::baz::A.foo2(); //~ ERROR: struct `A` is inaccessible
113 //~^ NOTE: module `baz` is private
114 ::bar::baz::A.bar2(); //~ ERROR: struct `A` is inaccessible
115 //~^ ERROR: method `bar2` is private
116 //~^^ NOTE: module `baz` is private
119 ::bar::B::foo(); //~ ERROR: method `foo` is inaccessible
120 //~^ NOTE: trait `B` is private
123 ::bar::Priv; //~ ERROR: variant `Priv` is private
127 ::bar::epriv(); //~ ERROR: function `epriv` is private
136 ::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible
137 //~^ NOTE: module `baz` is private
138 ::bar::baz::bar(); //~ ERROR: function `bar` is private
142 use bar::baz::{foo, bar};
143 //~^ ERROR: function `foo` is inaccessible
144 //~^^ ERROR: function `bar` is private
151 //~^ ERROR: module `baz` is private
166 impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
167 //~^ ERROR: trait `B` is private
171 // Even though the inner `A` struct is a publicly exported item (usable from
172 // external crates through `foo::foo`, it should not be accessible through
173 // its definition path (which has the private `i` module).
175 use self::foo::i::A; //~ ERROR: type `A` is inaccessible
176 //~^ NOTE: module `i` is private
179 pub use foo = self::i::A;
187 #[start] fn main(_: int, _: **u8) -> int { 3 }