about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-04-17 03:48:40 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-04-17 03:48:40 +0300
commite7bc939f1ee2ada3e3f679fd42c8e08d8a22996f (patch)
tree804e4a3221a669c42cbf6c4744c0f8b36c42c1d2 /src/test/compile-fail
parent6fa61b810dc95ca3e8bbda1681229f855f214fc4 (diff)
downloadrust-e7bc939f1ee2ada3e3f679fd42c8e08d8a22996f.tar.gz
rust-e7bc939f1ee2ada3e3f679fd42c8e08d8a22996f.zip
syntax: Parse import prefixes as paths
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/import-prefix-macro-1.rs26
-rw-r--r--src/test/compile-fail/import-prefix-macro-2.rs26
-rw-r--r--src/test/compile-fail/import-ty-params.rs25
-rw-r--r--src/test/compile-fail/self_type_keyword-2.rs13
-rw-r--r--src/test/compile-fail/self_type_keyword.rs3
5 files changed, 90 insertions, 3 deletions
diff --git a/src/test/compile-fail/import-prefix-macro-1.rs b/src/test/compile-fail/import-prefix-macro-1.rs
new file mode 100644
index 00000000000..beb15a11a96
--- /dev/null
+++ b/src/test/compile-fail/import-prefix-macro-1.rs
@@ -0,0 +1,26 @@
+// 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.
+
+mod a {
+    pub mod b {
+        pub mod c {
+            pub struct S;
+            pub struct Z;
+        }
+    }
+}
+
+macro_rules! import {
+    ($p: path) => (use $p {S, Z}); //~ERROR expected one of `::`, `;`, or `as`, found `{`
+}
+
+import! { a::b::c }
+
+fn main() {}
diff --git a/src/test/compile-fail/import-prefix-macro-2.rs b/src/test/compile-fail/import-prefix-macro-2.rs
new file mode 100644
index 00000000000..56c6273aa9a
--- /dev/null
+++ b/src/test/compile-fail/import-prefix-macro-2.rs
@@ -0,0 +1,26 @@
+// 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.
+
+mod a {
+    pub mod b {
+        pub mod c {
+            pub struct S;
+            pub struct Z;
+        }
+    }
+}
+
+macro_rules! import {
+    ($p: path) => (use ::$p {S, Z}); //~ERROR  expected identifier, found `a::b::c`
+}
+
+import! { a::b::c }
+
+fn main() {}
diff --git a/src/test/compile-fail/import-ty-params.rs b/src/test/compile-fail/import-ty-params.rs
new file mode 100644
index 00000000000..66d4d6d0621
--- /dev/null
+++ b/src/test/compile-fail/import-ty-params.rs
@@ -0,0 +1,25 @@
+// 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.
+
+mod a {
+    pub mod b {
+        pub mod c {
+            pub struct S<T>(T);
+        }
+    }
+}
+
+macro_rules! import {
+    ($p: path) => (use $p;);
+}
+
+import! { a::b::c::S<u8> } //~ERROR type or lifetime parameter is found in import path
+
+fn main() {}
diff --git a/src/test/compile-fail/self_type_keyword-2.rs b/src/test/compile-fail/self_type_keyword-2.rs
new file mode 100644
index 00000000000..613f54eb331
--- /dev/null
+++ b/src/test/compile-fail/self_type_keyword-2.rs
@@ -0,0 +1,13 @@
+// Copyright 2015 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.
+
+use self::Self as Foo; //~ ERROR unresolved import `self::Self`
+
+pub fn main() {}
diff --git a/src/test/compile-fail/self_type_keyword.rs b/src/test/compile-fail/self_type_keyword.rs
index 62966737874..b28f48bb105 100644
--- a/src/test/compile-fail/self_type_keyword.rs
+++ b/src/test/compile-fail/self_type_keyword.rs
@@ -39,9 +39,6 @@ pub fn main() {
     }
 }
 
-use self::Self as Foo;
-//~^ ERROR expected identifier, found keyword `Self`
-
 use std::option::Option as Self;
 //~^ ERROR expected identifier, found keyword `Self`