]> git.lizzy.rs Git - rust.git/commitdiff
Add tests
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Sat, 23 Apr 2016 06:22:38 +0000 (06:22 +0000)
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Wed, 27 Apr 2016 23:40:46 +0000 (23:40 +0000)
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs [new file with mode: 0644]
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs [new file with mode: 0644]
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs [new file with mode: 0644]
src/test/compile-fail/privacy/restricted/ty-params.rs

diff --git a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
new file mode 100644 (file)
index 0000000..9cc5338
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(pub_restricted, type_macros)]
+
+mod foo {
+    type T = ();
+    struct S1(pub(foo) (), pub(T), pub(crate) (), pub(((), T)));
+    struct S2(pub((foo)) ()); //~ ERROR expected one of `+` or `,`, found `(`
+                              //~| ERROR expected one of `+`, `;`, or `where`, found `(`
+}
diff --git a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
new file mode 100644 (file)
index 0000000..01466c6
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(pub_restricted, type_macros)]
+
+macro_rules! define_struct {
+    ($t:ty) => {
+        struct S1(pub $t);
+        struct S2(pub (foo) ());
+        struct S3(pub $t ()); //~ ERROR expected one of `+` or `,`, found `(`
+                              //~| ERROR expected one of `+`, `;`, or `where`, found `(`
+    }
+}
+
+mod foo {
+    define_struct! { (foo) }
+}
diff --git a/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs b/src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
new file mode 100644 (file)
index 0000000..ef187a1
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(pub_restricted, type_macros)]
+
+macro_rules! define_struct {
+    ($t:ty) => {
+        struct S1(pub($t));
+        struct S2(pub (foo) ());
+        struct S3(pub($t) ()); //~ ERROR expected one of `+` or `,`, found `(`
+                               //~| ERROR expected one of `+`, `;`, or `where`, found `(`
+    }
+}
+
+mod foo {
+    define_struct! { foo }
+}
index 04d8e9833045a27c49987a6f9edf374e72254ae4..ab423620d6866ff64e0e3e81160395251d9b91b0 100644 (file)
@@ -17,4 +17,8 @@ macro_rules! m {
 struct S<T>(T);
 m!{ S<u8> } //~ ERROR type or lifetime parameters in visibility path
 
+mod foo {
+    struct S(pub(foo<T>) ()); //~ ERROR type or lifetime parameters in visibility path
+}
+
 fn main() {}