about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMara <m-ou.se@m-ou.se>2021-03-05 10:57:15 +0100
committerGitHub <noreply@github.com>2021-03-05 10:57:15 +0100
commitec2619ca6219a74f3c97ac7c32aeecd79368788f (patch)
tree55dc230bcf7c8f965da50c24405eccf8c1780ee1 /src
parente6a6df5daad01472e93f19802b0ce25f7a9b020c (diff)
parent7b021aacb57d7a120f280302358d7bdd04a67bbc (diff)
downloadrust-ec2619ca6219a74f3c97ac7c32aeecd79368788f.tar.gz
rust-ec2619ca6219a74f3c97ac7c32aeecd79368788f.zip
Rollup merge of #80763 - petrochenkov:pubusecrate, r=estebank
resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lint

This lint was deny-by-default since July 2017, crater showed 7 uses on crates.io back then (https://github.com/rust-lang/rust/pull/42894#issuecomment-311921147).

Unfortunately, the construction `pub use foo as bar` where `foo` is `extern crate foo;` was used by an older version `bitflags`, so turning it into an error causes too many regressions.
So, this PR reduces the scope of the lint instead of turning it into a hard error, and only turns some more rarely used components of it into errors.
Diffstat (limited to 'src')
-rw-r--r--src/test/rustdoc/extern-links.rs2
-rw-r--r--src/test/rustdoc/issue-28927.rs2
-rw-r--r--src/test/ui/pub/pub-reexport-priv-extern-crate.rs8
-rw-r--r--src/test/ui/pub/pub-reexport-priv-extern-crate.stderr39
4 files changed, 27 insertions, 24 deletions
diff --git a/src/test/rustdoc/extern-links.rs b/src/test/rustdoc/extern-links.rs
index 991f869138d..0383ccf7db6 100644
--- a/src/test/rustdoc/extern-links.rs
+++ b/src/test/rustdoc/extern-links.rs
@@ -3,7 +3,7 @@
 
 #![crate_name = "foo"]
 
-extern crate extern_links;
+pub extern crate extern_links;
 
 // @!has foo/index.html '//a' 'extern_links'
 #[doc(no_inline)]
diff --git a/src/test/rustdoc/issue-28927.rs b/src/test/rustdoc/issue-28927.rs
index 7b535f33bf7..38a520850b6 100644
--- a/src/test/rustdoc/issue-28927.rs
+++ b/src/test/rustdoc/issue-28927.rs
@@ -2,5 +2,5 @@
 // aux-build:issue-28927-1.rs
 // ignore-cross-compile
 
-extern crate issue_28927_1 as inner1;
+pub extern crate issue_28927_1 as inner1;
 pub use inner1 as foo;
diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.rs b/src/test/ui/pub/pub-reexport-priv-extern-crate.rs
index e95d6924026..dd5cd420fa5 100644
--- a/src/test/ui/pub/pub-reexport-priv-extern-crate.rs
+++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.rs
@@ -1,5 +1,3 @@
-#![allow(unused)]
-
 extern crate core;
 pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported
                                  //~^ WARN this was previously accepted
@@ -9,16 +7,14 @@ mod foo1 {
 }
 
 mod foo2 {
-    use foo1::core; //~ ERROR `core` is private, and cannot be re-exported
-                    //~^ WARN this was previously accepted
+    use foo1::core; //~ ERROR crate import `core` is private
     pub mod bar {
         extern crate core;
     }
 }
 
 mod baz {
-    pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be re-exported
-                             //~^ WARN this was previously accepted
+    pub use foo2::bar::core; //~ ERROR crate import `core` is private
 }
 
 fn main() {}
diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr
index 0b44c5a6525..e4d73c6475d 100644
--- a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr
+++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr
@@ -1,30 +1,37 @@
-error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
-  --> $DIR/pub-reexport-priv-extern-crate.rs:4:9
+error[E0603]: crate import `core` is private
+  --> $DIR/pub-reexport-priv-extern-crate.rs:10:15
    |
-LL | pub use core as reexported_core;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^
+LL |     use foo1::core;
+   |               ^^^^ private crate import
    |
-   = note: `#[deny(pub_use_of_private_extern_crate)]` on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: the crate import `core` is defined here
+  --> $DIR/pub-reexport-priv-extern-crate.rs:6:5
+   |
+LL |     extern crate core;
+   |     ^^^^^^^^^^^^^^^^^^
 
-error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
-  --> $DIR/pub-reexport-priv-extern-crate.rs:12:9
+error[E0603]: crate import `core` is private
+  --> $DIR/pub-reexport-priv-extern-crate.rs:17:24
    |
-LL |     use foo1::core;
-   |         ^^^^^^^^^^
+LL |     pub use foo2::bar::core;
+   |                        ^^^^ private crate import
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: the crate import `core` is defined here
+  --> $DIR/pub-reexport-priv-extern-crate.rs:12:9
+   |
+LL |         extern crate core;
+   |         ^^^^^^^^^^^^^^^^^^
 
 error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
-  --> $DIR/pub-reexport-priv-extern-crate.rs:20:13
+  --> $DIR/pub-reexport-priv-extern-crate.rs:2:9
    |
-LL |     pub use foo2::bar::core;
-   |             ^^^^^^^^^^^^^^^
+LL | pub use core as reexported_core;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: `#[deny(pub_use_of_private_extern_crate)]` on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
 
 error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0603`.