about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-01-10 08:55:53 +0000
committerbors <bors@rust-lang.org>2022-01-10 08:55:53 +0000
commitdf035a33b228daa700ac50712d9e16509d373e41 (patch)
treee98f02a220de459f6b5da0d52985cef02f624af7 /src
parentd63a8d965e76f29a2b65c1f22a32613df1fe5c2c (diff)
parent3a77bb86ff33bd4633aa831f2580aa3792a9c279 (diff)
Auto merge of #87487 - lambinoo:I-64762_unreachable_pub_lint, r=petrochenkov
Fixes wrong unreachable_pub lints on nested and glob public reexport

Linked issues: #64762 & #82064
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/lint/lint-pub-unreachable-for-nested-glob.rs28
-rw-r--r--src/tools/rustfmt/src/lib.rs1
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/lint/lint-pub-unreachable-for-nested-glob.rs b/src/test/ui/lint/lint-pub-unreachable-for-nested-glob.rs
new file mode 100644
index 00000000000..2df6d08e7ae
--- /dev/null
+++ b/src/test/ui/lint/lint-pub-unreachable-for-nested-glob.rs
@@ -0,0 +1,28 @@
+// check-pass
+
+#![deny(unreachable_pub)]
+
+pub use self::m1::*;
+
+mod m1 {
+    pub use self::m2::*;
+
+    mod m2 {
+        pub struct Item1;
+        pub struct Item2;
+    }
+}
+
+
+pub use self::o1::{ Item42, Item24 };
+
+mod o1 {
+    pub use self::o2::{ Item42, Item24 };
+
+    mod o2 {
+        pub struct Item42;
+        pub struct Item24;
+    }
+}
+
+fn main() {}
diff --git a/src/tools/rustfmt/src/lib.rs b/src/tools/rustfmt/src/lib.rs
index ad23b16e02e..fae8080c02e 100644
--- a/src/tools/rustfmt/src/lib.rs
+++ b/src/tools/rustfmt/src/lib.rs
@@ -3,6 +3,7 @@
 #![warn(unreachable_pub)]
 #![recursion_limit = "256"]
 #![allow(clippy::match_like_matches_macro)]
+#![allow(unreachable_pub)]
 
 #[macro_use]
 extern crate derive_new;