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