summaryrefslogtreecommitdiffstats
path: root/src/test/ui/use/use-mod
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/use/use-mod')
-rw-r--r--src/test/ui/use/use-mod/use-mod-2.rs11
-rw-r--r--src/test/ui/use/use-mod/use-mod-2.stderr15
-rw-r--r--src/test/ui/use/use-mod/use-mod-3.rs12
-rw-r--r--src/test/ui/use/use-mod/use-mod-3.stderr27
-rw-r--r--src/test/ui/use/use-mod/use-mod-4.rs7
-rw-r--r--src/test/ui/use/use-mod/use-mod-4.stderr42
-rw-r--r--src/test/ui/use/use-mod/use-mod-5.rs13
-rw-r--r--src/test/ui/use/use-mod/use-mod-5.stderr19
-rw-r--r--src/test/ui/use/use-mod/use-mod-6.rs13
-rw-r--r--src/test/ui/use/use-mod/use-mod-6.stderr19
10 files changed, 178 insertions, 0 deletions
diff --git a/src/test/ui/use/use-mod/use-mod-2.rs b/src/test/ui/use/use-mod/use-mod-2.rs
new file mode 100644
index 000000000..9373a62ba
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-2.rs
@@ -0,0 +1,11 @@
+mod foo {
+ use self::{self};
+ //~^ ERROR unresolved import `self` [E0432]
+ //~| no `self` in the root
+
+ use super::{self};
+ //~^ ERROR unresolved import `super` [E0432]
+ //~| no `super` in the root
+}
+
+fn main() {}
diff --git a/src/test/ui/use/use-mod/use-mod-2.stderr b/src/test/ui/use/use-mod/use-mod-2.stderr
new file mode 100644
index 000000000..843767849
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-2.stderr
@@ -0,0 +1,15 @@
+error[E0432]: unresolved import `self`
+ --> $DIR/use-mod-2.rs:2:16
+ |
+LL | use self::{self};
+ | ^^^^ no `self` in the root
+
+error[E0432]: unresolved import `super`
+ --> $DIR/use-mod-2.rs:6:17
+ |
+LL | use super::{self};
+ | ^^^^ no `super` in the root
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/use/use-mod/use-mod-3.rs b/src/test/ui/use/use-mod/use-mod-3.rs
new file mode 100644
index 000000000..0afa486b9
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-3.rs
@@ -0,0 +1,12 @@
+use foo::bar::{ //~ ERROR module `bar` is private
+ self
+};
+use foo::bar::{ //~ ERROR module `bar` is private
+ Bar
+};
+
+mod foo {
+ mod bar { pub type Bar = isize; }
+}
+
+fn main() {}
diff --git a/src/test/ui/use/use-mod/use-mod-3.stderr b/src/test/ui/use/use-mod/use-mod-3.stderr
new file mode 100644
index 000000000..1b12b3c6f
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-3.stderr
@@ -0,0 +1,27 @@
+error[E0603]: module `bar` is private
+ --> $DIR/use-mod-3.rs:1:10
+ |
+LL | use foo::bar::{
+ | ^^^ private module
+ |
+note: the module `bar` is defined here
+ --> $DIR/use-mod-3.rs:9:5
+ |
+LL | mod bar { pub type Bar = isize; }
+ | ^^^^^^^
+
+error[E0603]: module `bar` is private
+ --> $DIR/use-mod-3.rs:4:10
+ |
+LL | use foo::bar::{
+ | ^^^ private module
+ |
+note: the module `bar` is defined here
+ --> $DIR/use-mod-3.rs:9:5
+ |
+LL | mod bar { pub type Bar = isize; }
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/use/use-mod/use-mod-4.rs b/src/test/ui/use/use-mod/use-mod-4.rs
new file mode 100644
index 000000000..46ae8ddad
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-4.rs
@@ -0,0 +1,7 @@
+use foo::self; //~ ERROR unresolved import `foo`
+//~^ ERROR `self` imports are only allowed within a { } list
+
+use std::mem::self;
+//~^ ERROR `self` imports are only allowed within a { } list
+
+fn main() {}
diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr
new file mode 100644
index 000000000..0b4fbadb4
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-4.stderr
@@ -0,0 +1,42 @@
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-mod-4.rs:1:8
+ |
+LL | use foo::self;
+ | ^^^^^^
+ |
+help: consider importing the module directly
+ |
+LL - use foo::self;
+LL + use foo;
+ |
+help: alternatively, use the multi-path `use` syntax to import `self`
+ |
+LL | use foo::{self};
+ | + +
+
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-mod-4.rs:4:13
+ |
+LL | use std::mem::self;
+ | ^^^^^^
+ |
+help: consider importing the module directly
+ |
+LL - use std::mem::self;
+LL + use std::mem;
+ |
+help: alternatively, use the multi-path `use` syntax to import `self`
+ |
+LL | use std::mem::{self};
+ | + +
+
+error[E0432]: unresolved import `foo`
+ --> $DIR/use-mod-4.rs:1:5
+ |
+LL | use foo::self;
+ | ^^^^^^^^^ no `foo` in the root
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0429, E0432.
+For more information about an error, try `rustc --explain E0429`.
diff --git a/src/test/ui/use/use-mod/use-mod-5.rs b/src/test/ui/use/use-mod/use-mod-5.rs
new file mode 100644
index 000000000..df5b423ec
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-5.rs
@@ -0,0 +1,13 @@
+mod foo {
+ pub mod bar {
+ pub fn drop() {}
+ }
+}
+
+use foo::bar::self;
+//~^ ERROR `self` imports are only allowed within a { } list
+
+fn main() {
+ // Because of error recovery this shouldn't error
+ bar::drop();
+}
diff --git a/src/test/ui/use/use-mod/use-mod-5.stderr b/src/test/ui/use/use-mod/use-mod-5.stderr
new file mode 100644
index 000000000..62859e261
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-5.stderr
@@ -0,0 +1,19 @@
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-mod-5.rs:7:13
+ |
+LL | use foo::bar::self;
+ | ^^^^^^
+ |
+help: consider importing the module directly
+ |
+LL - use foo::bar::self;
+LL + use foo::bar;
+ |
+help: alternatively, use the multi-path `use` syntax to import `self`
+ |
+LL | use foo::bar::{self};
+ | + +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0429`.
diff --git a/src/test/ui/use/use-mod/use-mod-6.rs b/src/test/ui/use/use-mod/use-mod-6.rs
new file mode 100644
index 000000000..1f8777dac
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-6.rs
@@ -0,0 +1,13 @@
+mod foo {
+ pub mod bar {
+ pub fn drop() {}
+ }
+}
+
+use foo::bar::self as abc;
+//~^ ERROR `self` imports are only allowed within a { } list
+
+fn main() {
+ // Because of error recovery this shouldn't error
+ abc::drop();
+}
diff --git a/src/test/ui/use/use-mod/use-mod-6.stderr b/src/test/ui/use/use-mod/use-mod-6.stderr
new file mode 100644
index 000000000..2d2c90067
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-6.stderr
@@ -0,0 +1,19 @@
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-mod-6.rs:7:13
+ |
+LL | use foo::bar::self as abc;
+ | ^^^^^^
+ |
+help: consider importing the module directly
+ |
+LL - use foo::bar::self as abc;
+LL + use foo::bar as abc;
+ |
+help: alternatively, use the multi-path `use` syntax to import `self`
+ |
+LL | use foo::bar::{self as abc};
+ | + +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0429`.