summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/privacy-sanity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/privacy/privacy-sanity.rs')
-rw-r--r--tests/ui/privacy/privacy-sanity.rs82
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/ui/privacy/privacy-sanity.rs b/tests/ui/privacy/privacy-sanity.rs
new file mode 100644
index 000000000..8bbf1ab5d
--- /dev/null
+++ b/tests/ui/privacy/privacy-sanity.rs
@@ -0,0 +1,82 @@
+#![feature(negative_impls)]
+
+pub trait Tr {
+ fn f();
+ const C: u8;
+ type T;
+}
+pub struct S {
+ pub a: u8
+}
+struct Ts(pub u8);
+
+pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
+ pub fn f() {} //~ ERROR unnecessary visibility qualifier
+ pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
+ pub type T = u8; //~ ERROR unnecessary visibility qualifier
+}
+pub impl S { //~ ERROR unnecessary visibility qualifier
+ pub fn f() {}
+ pub const C: u8 = 0;
+ // pub type T = u8;
+}
+pub extern "C" { //~ ERROR unnecessary visibility qualifier
+ pub fn f();
+ pub static St: u8;
+}
+
+const MAIN: u8 = {
+ pub trait Tr {
+ fn f();
+ const C: u8;
+ type T;
+ }
+ pub struct S {
+ pub a: u8
+ }
+ struct Ts(pub u8);
+
+ pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
+ pub fn f() {} //~ ERROR unnecessary visibility qualifier
+ pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
+ pub type T = u8; //~ ERROR unnecessary visibility qualifier
+ }
+ pub impl S { //~ ERROR unnecessary visibility qualifier
+ pub fn f() {}
+ pub const C: u8 = 0;
+ // pub type T = u8;
+ }
+ pub extern "C" { //~ ERROR unnecessary visibility qualifier
+ pub fn f();
+ pub static St: u8;
+ }
+
+ 0
+};
+
+fn main() {
+ pub trait Tr {
+ fn f();
+ const C: u8;
+ type T;
+ }
+ pub struct S {
+ pub a: u8
+ }
+ struct Ts(pub u8);
+
+ pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
+ pub fn f() {} //~ ERROR unnecessary visibility qualifier
+ pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
+ pub type T = u8; //~ ERROR unnecessary visibility qualifier
+ }
+ pub impl S { //~ ERROR unnecessary visibility qualifier
+ pub fn f() {}
+ pub const C: u8 = 0;
+ // pub type T = u8;
+ }
+ pub extern "C" { //~ ERROR unnecessary visibility qualifier
+ pub fn f();
+ pub static St: u8;
+ }
+}