about summary refs log tree commit diff
path: root/src/test/compile-fail/use-mod.rs
diff options
context:
space:
mode:
authorJakub Wieczorek <jakub@jakub.cc>2014-07-18 00:56:56 +0200
committerJakub Wieczorek <jakub@jakub.cc>2014-07-20 12:40:08 +0200
commit4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4 (patch)
treeada16b620d93f1ae709185df0986c58a62614e8d /src/test/compile-fail/use-mod.rs
parent50481f55030f02543e1b3b6ae008d77b1cef3e98 (diff)
downloadrust-4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4.tar.gz
rust-4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4.zip
Implement new mod import sugar
Implements RFC #168.
Diffstat (limited to 'src/test/compile-fail/use-mod.rs')
-rw-r--r--src/test/compile-fail/use-mod.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/compile-fail/use-mod.rs b/src/test/compile-fail/use-mod.rs
new file mode 100644
index 00000000000..b2b0eb21ace
--- /dev/null
+++ b/src/test/compile-fail/use-mod.rs
@@ -0,0 +1,32 @@
+// Copyright 2014 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 foo::bar::{
+    mod,
+//~^ ERROR `mod` import can only appear once in the list
+    Bar,
+    mod
+//~^ NOTE another `mod` import appears here
+};
+
+use {mod};
+//~^ ERROR `mod` import can only appear in an import list with a non-empty prefix
+
+use foo::mod;
+//~^ ERROR `mod` imports are only allowed within a { } list
+
+mod foo {
+    pub mod bar {
+        pub struct Bar;
+        pub struct Baz;
+    }
+}
+
+fn main() {}