about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/imports/pub-reexport-empty.rs25
-rw-r--r--tests/ui/imports/pub-reexport-empty.stderr20
-rw-r--r--tests/ui/imports/reexports.rs5
-rw-r--r--tests/ui/imports/reexports.stderr34
-rw-r--r--tests/ui/lint/unused/lint-unused-imports.rs2
-rw-r--r--tests/ui/parser/recover-missing-semi-before-item.fixed2
-rw-r--r--tests/ui/parser/recover-missing-semi-before-item.rs2
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr38
-rw-r--r--tests/ui/privacy/private-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/private-variant-reexport.stderr8
11 files changed, 120 insertions, 24 deletions
diff --git a/tests/ui/imports/pub-reexport-empty.rs b/tests/ui/imports/pub-reexport-empty.rs
new file mode 100644
index 00000000000..2a46f4c8de8
--- /dev/null
+++ b/tests/ui/imports/pub-reexport-empty.rs
@@ -0,0 +1,25 @@
+#![deny(unused_imports)]
+
+mod a {}
+
+pub use a::*;
+//~^ ERROR: unused import: `a::*`
+
+mod b {
+    mod c {
+        #[derive(Clone)]
+        pub struct D;
+    }
+    pub use self::c::*; // don't show unused import lint
+}
+
+pub use b::*; // don't show unused import lint
+
+mod d {
+    const D: i32 = 1;
+}
+
+pub use d::*;
+//~^ ERROR: unused import: `d::*`
+
+fn main() {}
diff --git a/tests/ui/imports/pub-reexport-empty.stderr b/tests/ui/imports/pub-reexport-empty.stderr
new file mode 100644
index 00000000000..813b2ef71c5
--- /dev/null
+++ b/tests/ui/imports/pub-reexport-empty.stderr
@@ -0,0 +1,20 @@
+error: unused import: `a::*`
+  --> $DIR/pub-reexport-empty.rs:5:9
+   |
+LL | pub use a::*;
+   |         ^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/pub-reexport-empty.rs:1:9
+   |
+LL | #![deny(unused_imports)]
+   |         ^^^^^^^^^^^^^^
+
+error: unused import: `d::*`
+  --> $DIR/pub-reexport-empty.rs:22:9
+   |
+LL | pub use d::*;
+   |         ^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/imports/reexports.rs b/tests/ui/imports/reexports.rs
index d76cc41be4e..cb1a3ebe180 100644
--- a/tests/ui/imports/reexports.rs
+++ b/tests/ui/imports/reexports.rs
@@ -5,9 +5,12 @@ mod a {
     mod foo {}
 
     mod a {
-        pub use super::foo; //~ ERROR cannot be re-exported
+        pub use super::foo;
+        //~^ ERROR cannot be re-exported
+        //~| WARNING unused import: `super::foo`
         pub use super::*;
         //~^ WARNING glob import doesn't reexport anything because no candidate is public enough
+        //~| WARNING unused import: `super::*`
     }
 }
 
diff --git a/tests/ui/imports/reexports.stderr b/tests/ui/imports/reexports.stderr
index 8cbff0ac73d..401e422af0f 100644
--- a/tests/ui/imports/reexports.stderr
+++ b/tests/ui/imports/reexports.stderr
@@ -11,44 +11,44 @@ LL |         pub use super::foo;
    |                 ^^^^^^^^^^
 
 error[E0603]: module import `foo` is private
-  --> $DIR/reexports.rs:33:15
+  --> $DIR/reexports.rs:36:15
    |
 LL |     use b::a::foo::S;
    |               ^^^ private module import
    |
 note: the module import `foo` is defined here...
-  --> $DIR/reexports.rs:21:17
+  --> $DIR/reexports.rs:24:17
    |
 LL |         pub use super::foo; // This is OK since the value `foo` is visible enough.
    |                 ^^^^^^^^^^
 note: ...and refers to the module `foo` which is defined here
-  --> $DIR/reexports.rs:16:5
+  --> $DIR/reexports.rs:19:5
    |
 LL |     mod foo {
    |     ^^^^^^^
 
 error[E0603]: module import `foo` is private
-  --> $DIR/reexports.rs:34:15
+  --> $DIR/reexports.rs:37:15
    |
 LL |     use b::b::foo::S as T;
    |               ^^^ private module import
    |
 note: the module import `foo` is defined here...
-  --> $DIR/reexports.rs:26:17
+  --> $DIR/reexports.rs:29:17
    |
 LL |         pub use super::*; // This is also OK since the value `foo` is visible enough.
    |                 ^^^^^^^^
 note: ...and refers to the module `foo` which is defined here
-  --> $DIR/reexports.rs:16:5
+  --> $DIR/reexports.rs:19:5
    |
 LL |     mod foo {
    |     ^^^^^^^
 
-warning: glob import doesn't reexport anything because no candidate is public enough
-  --> $DIR/reexports.rs:9:17
+warning: unused import: `super::foo`
+  --> $DIR/reexports.rs:8:17
    |
-LL |         pub use super::*;
-   |                 ^^^^^^^^
+LL |         pub use super::foo;
+   |                 ^^^^^^^^^^
    |
 note: the lint level is defined here
   --> $DIR/reexports.rs:1:9
@@ -56,7 +56,19 @@ note: the lint level is defined here
 LL | #![warn(unused_imports)]
    |         ^^^^^^^^^^^^^^
 
-error: aborting due to 3 previous errors; 1 warning emitted
+warning: glob import doesn't reexport anything because no candidate is public enough
+  --> $DIR/reexports.rs:11:17
+   |
+LL |         pub use super::*;
+   |                 ^^^^^^^^
+
+warning: unused import: `super::*`
+  --> $DIR/reexports.rs:11:17
+   |
+LL |         pub use super::*;
+   |                 ^^^^^^^^
+
+error: aborting due to 3 previous errors; 3 warnings emitted
 
 Some errors have detailed explanations: E0364, E0603.
 For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/lint/unused/lint-unused-imports.rs b/tests/ui/lint/unused/lint-unused-imports.rs
index 953992ecf71..4fa6511c97e 100644
--- a/tests/ui/lint/unused/lint-unused-imports.rs
+++ b/tests/ui/lint/unused/lint-unused-imports.rs
@@ -42,7 +42,7 @@ mod foo {
     pub struct Square{pub p: Point, pub h: usize, pub w: usize}
 }
 
-mod bar {
+pub mod bar {
     // Don't ignore on 'pub use' because we're not sure if it's used or not
     pub use std::cmp::PartialEq;
     pub struct Square;
diff --git a/tests/ui/parser/recover-missing-semi-before-item.fixed b/tests/ui/parser/recover-missing-semi-before-item.fixed
index 0be17e69e8f..acb846373cb 100644
--- a/tests/ui/parser/recover-missing-semi-before-item.fixed
+++ b/tests/ui/parser/recover-missing-semi-before-item.fixed
@@ -1,6 +1,6 @@
 // run-rustfix
 
-#![allow(unused_variables, dead_code)]
+#![allow(unused_variables, dead_code, unused_imports)]
 
 fn for_struct() {
     let foo = 3; //~ ERROR expected `;`, found keyword `struct`
diff --git a/tests/ui/parser/recover-missing-semi-before-item.rs b/tests/ui/parser/recover-missing-semi-before-item.rs
index 867b7b749bb..ef6cfe3c4ed 100644
--- a/tests/ui/parser/recover-missing-semi-before-item.rs
+++ b/tests/ui/parser/recover-missing-semi-before-item.rs
@@ -1,6 +1,6 @@
 // run-rustfix
 
-#![allow(unused_variables, dead_code)]
+#![allow(unused_variables, dead_code, unused_imports)]
 
 fn for_struct() {
     let foo = 3 //~ ERROR expected `;`, found keyword `struct`
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
index 6f115e78e14..653dcab5771 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
@@ -2,13 +2,17 @@
 mod rank {
     pub use self::Professor::*;
     //~^ ERROR glob import doesn't reexport anything
+    //~| ERROR unused import: `self::Professor::*`
     pub use self::Lieutenant::{JuniorGrade, Full};
     //~^ ERROR `JuniorGrade` is private, and cannot be re-exported
     //~| ERROR `Full` is private, and cannot be re-exported
+    //~| ERROR unused imports: `Full`, `JuniorGrade`
     pub use self::PettyOfficer::*;
     //~^ ERROR glob import doesn't reexport anything
+    //~| ERROR unused import: `self::PettyOfficer::*`
     pub use self::Crewman::*;
     //~^ ERROR glob import doesn't reexport anything
+    //~| ERROR unused import: `self::Crewman::*`
 
     enum Professor {
         Adjunct,
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
index 59b181fab40..df5968ba323 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
@@ -1,23 +1,23 @@
 error[E0364]: `JuniorGrade` is private, and cannot be re-exported
-  --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
    |
 LL |     pub use self::Lieutenant::{JuniorGrade, Full};
    |                                ^^^^^^^^^^^
    |
 note: consider marking `JuniorGrade` as `pub` in the imported module
-  --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
    |
 LL |     pub use self::Lieutenant::{JuniorGrade, Full};
    |                                ^^^^^^^^^^^
 
 error[E0364]: `Full` is private, and cannot be re-exported
-  --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
    |
 LL |     pub use self::Lieutenant::{JuniorGrade, Full};
    |                                             ^^^^
    |
 note: consider marking `Full` as `pub` in the imported module
-  --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
    |
 LL |     pub use self::Lieutenant::{JuniorGrade, Full};
    |                                             ^^^^
@@ -34,18 +34,42 @@ note: the lint level is defined here
 LL | #[deny(unused_imports)]
    |        ^^^^^^^^^^^^^^
 
+error: unused import: `self::Professor::*`
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:3:13
+   |
+LL |     pub use self::Professor::*;
+   |             ^^^^^^^^^^^^^^^^^^
+
+error: unused imports: `Full`, `JuniorGrade`
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
+   |
+LL |     pub use self::Lieutenant::{JuniorGrade, Full};
+   |                                ^^^^^^^^^^^  ^^^^
+
 error: glob import doesn't reexport anything because no candidate is public enough
-  --> $DIR/issue-46209-private-enum-variant-reexport.rs:8:13
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
    |
 LL |     pub use self::PettyOfficer::*;
    |             ^^^^^^^^^^^^^^^^^^^^^
 
-error: glob import doesn't reexport anything because no candidate is public enough
+error: unused import: `self::PettyOfficer::*`
   --> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
    |
+LL |     pub use self::PettyOfficer::*;
+   |             ^^^^^^^^^^^^^^^^^^^^^
+
+error: glob import doesn't reexport anything because no candidate is public enough
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+   |
+LL |     pub use self::Crewman::*;
+   |             ^^^^^^^^^^^^^^^^
+
+error: unused import: `self::Crewman::*`
+  --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+   |
 LL |     pub use self::Crewman::*;
    |             ^^^^^^^^^^^^^^^^
 
-error: aborting due to 5 previous errors
+error: aborting due to 9 previous errors
 
 For more information about this error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/private-variant-reexport.rs b/tests/ui/privacy/private-variant-reexport.rs
index 68828446022..b59243af620 100644
--- a/tests/ui/privacy/private-variant-reexport.rs
+++ b/tests/ui/privacy/private-variant-reexport.rs
@@ -12,7 +12,9 @@ mod m3 {
 
 #[deny(unused_imports)]
 mod m4 {
-    pub use ::E::*; //~ ERROR glob import doesn't reexport anything
+    pub use ::E::*;
+    //~^ ERROR glob import doesn't reexport anything
+    //~| ERROR unused import: `::E::*`
 }
 
 enum E { V }
diff --git a/tests/ui/privacy/private-variant-reexport.stderr b/tests/ui/privacy/private-variant-reexport.stderr
index 78771ee30d3..2f041934a81 100644
--- a/tests/ui/privacy/private-variant-reexport.stderr
+++ b/tests/ui/privacy/private-variant-reexport.stderr
@@ -42,7 +42,13 @@ note: the lint level is defined here
 LL | #[deny(unused_imports)]
    |        ^^^^^^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error: unused import: `::E::*`
+  --> $DIR/private-variant-reexport.rs:15:13
+   |
+LL |     pub use ::E::*;
+   |             ^^^^^^
+
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0364, E0365.
 For more information about an error, try `rustc --explain E0364`.