]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/privacy-sanity.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / privacy-sanity.rs
1 // Copyright 2015 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 #![feature(associated_consts)]
12 #![feature(optin_builtin_traits)]
13
14 trait MarkerTr {}
15 pub trait Tr {
16 fn f();
17 const C: u8;
18 type T;
19 }
20 pub struct S {
21 pub a: u8
22 }
23 struct Ts(pub u8);
24
25 pub impl MarkerTr for .. {} //~ ERROR unnecessary visibility qualifier
26 pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
27 pub fn f() {} //~ ERROR unnecessary visibility qualifier
28 pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
29 pub type T = u8; //~ ERROR unnecessary visibility qualifier
30 }
31 pub impl S { //~ ERROR unnecessary visibility qualifier
32 pub fn f() {}
33 pub const C: u8 = 0;
34 // pub type T = u8;
35 }
36 pub extern "C" { //~ ERROR unnecessary visibility qualifier
37 pub fn f();
38 pub static St: u8;
39 }
40
41 const MAIN: u8 = {
42 trait MarkerTr {}
43 pub trait Tr {
44 fn f();
45 const C: u8;
46 type T;
47 }
48 pub struct S {
49 pub a: u8
50 }
51 struct Ts(pub u8);
52
53 pub impl MarkerTr for .. {} //~ ERROR unnecessary visibility qualifier
54 pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
55 pub fn f() {} //~ ERROR unnecessary visibility qualifier
56 pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
57 pub type T = u8; //~ ERROR unnecessary visibility qualifier
58 }
59 pub impl S { //~ ERROR unnecessary visibility qualifier
60 pub fn f() {}
61 pub const C: u8 = 0;
62 // pub type T = u8;
63 }
64 pub extern "C" { //~ ERROR unnecessary visibility qualifier
65 pub fn f();
66 pub static St: u8;
67 }
68
69 0
70 };
71
72 fn main() {
73 trait MarkerTr {}
74 pub trait Tr {
75 fn f();
76 const C: u8;
77 type T;
78 }
79 pub struct S {
80 pub a: u8
81 }
82 struct Ts(pub u8);
83
84 pub impl MarkerTr for .. {} //~ ERROR unnecessary visibility qualifier
85 pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
86 pub fn f() {} //~ ERROR unnecessary visibility qualifier
87 pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
88 pub type T = u8; //~ ERROR unnecessary visibility qualifier
89 }
90 pub impl S { //~ ERROR unnecessary visibility qualifier
91 pub fn f() {}
92 pub const C: u8 = 0;
93 // pub type T = u8;
94 }
95 pub extern "C" { //~ ERROR unnecessary visibility qualifier
96 pub fn f();
97 pub static St: u8;
98 }
99 }