]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/xcrate-private-by-default.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / xcrate-private-by-default.rs
CommitLineData
1a4d82fc
JJ
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.
4//
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.
10
11// aux-build:static_priv_by_default.rs
12
13extern crate static_priv_by_default;
14
15fn foo<T>() {}
16
17fn main() {
18 // Actual public items should be public
19 static_priv_by_default::a;
20 static_priv_by_default::b;
21 static_priv_by_default::c;
22 foo::<static_priv_by_default::d>();
23 foo::<static_priv_by_default::e>();
24
25 // publicly re-exported items should be available
26 static_priv_by_default::bar::e;
27 static_priv_by_default::bar::f;
28 static_priv_by_default::bar::g;
29 foo::<static_priv_by_default::bar::h>();
30 foo::<static_priv_by_default::bar::i>();
31
32 // private items at the top should be inaccessible
33 static_priv_by_default::j;
34 //~^ ERROR: static `j` is private
35 static_priv_by_default::k;
36 //~^ ERROR: function `k` is private
37 static_priv_by_default::l;
38 //~^ ERROR: struct `l` is private
39 foo::<static_priv_by_default::m>();
40 //~^ ERROR: enum `m` is private
41 foo::<static_priv_by_default::n>();
42 //~^ ERROR: type `n` is private
43
44 // public items in a private mod should be inaccessible
45 static_priv_by_default::foo::a;
54a0048b 46 //~^ ERROR: module `foo` is private
1a4d82fc 47 static_priv_by_default::foo::b;
54a0048b 48 //~^ ERROR: module `foo` is private
1a4d82fc 49 static_priv_by_default::foo::c;
54a0048b 50 //~^ ERROR: module `foo` is private
1a4d82fc 51 foo::<static_priv_by_default::foo::d>();
54a0048b 52 //~^ ERROR: module `foo` is private
1a4d82fc 53 foo::<static_priv_by_default::foo::e>();
54a0048b 54 //~^ ERROR: module `foo` is private
1a4d82fc 55}