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)
15 pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
16 impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
19 pub trait Sized : PhantomFn<Self> {}
22 pub trait Copy : PhantomFn<Self> {}
25 // shouldn't bring in too much
26 pub use self::glob::*;
28 // can't publicly re-export private items
29 pub use self::baz::{foo, bar};
44 impl B for isize { fn foo() -> isize { 3 } }
77 self::baz::A::bar(); //~ ERROR: method `bar` is private
79 self::baz::A.bar2(); //~ ERROR: method `bar2` is private
81 // this used to cause an ICE in privacy traversal.
96 bar::A::bar(); //~ ERROR: method `bar` is private
98 bar::A.bar2(); //~ ERROR: method `bar2` is private
104 ::bar::A::bar(); //~ ERROR: method `bar` is private
106 ::bar::A.bar2(); //~ ERROR: method `bar2` is private
107 ::bar::baz::A::foo(); //~ ERROR: method `foo` is inaccessible
108 //~^ NOTE: module `baz` is private
109 ::bar::baz::A::bar(); //~ ERROR: method `bar` is private
110 ::bar::baz::A.foo2(); //~ ERROR: struct `A` is inaccessible
111 //~^ NOTE: module `baz` is private
112 ::bar::baz::A.bar2(); //~ ERROR: struct `A` is inaccessible
113 //~^ ERROR: method `bar2` is private
114 //~^^ NOTE: module `baz` is private
117 ::bar::B::foo(); //~ ERROR: method `foo` is inaccessible
118 //~^ NOTE: trait `B` is private
124 ::bar::epriv(); //~ ERROR: function `epriv` is private
133 ::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible
134 //~^ NOTE: module `baz` is private
135 ::bar::baz::bar(); //~ ERROR: function `bar` is inaccessible
139 use bar::baz::{foo, bar};
140 //~^ ERROR: function `foo` is inaccessible
141 //~^^ ERROR: function `bar` is inaccessible
148 //~^ ERROR: module `baz` is private
163 impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
164 //~^ ERROR: trait `B` is private
168 // Even though the inner `A` struct is a publicly exported item (usable from
169 // external crates through `foo::foo`, it should not be accessible through
170 // its definition path (which has the private `i` module).
171 use self::foo::i::A; //~ ERROR: type `A` is inaccessible
172 //~^ NOTE: module `i` is private
175 pub use self::i::A as foo;
183 #[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }