resolve: Reduce scope of pub_use_of_private_extern_crate deprecation lint

This commit is contained in:
Vadim Petrochenkov 2021-01-29 00:59:20 +03:00
parent 9ce7268bcf
commit 7b021aacb5
5 changed files with 50 additions and 39 deletions

View file

@ -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)]

View file

@ -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;

View file

@ -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() {}

View file

@ -1,5 +1,29 @@
error[E0603]: crate import `core` is private
--> $DIR/pub-reexport-priv-extern-crate.rs:10:15
|
LL | use foo1::core;
| ^^^^ private crate import
|
note: the crate import `core` is defined here
--> $DIR/pub-reexport-priv-extern-crate.rs:6:5
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^
error[E0603]: crate import `core` is private
--> $DIR/pub-reexport-priv-extern-crate.rs:17:24
|
LL | pub use foo2::bar::core;
| ^^^^ private crate import
|
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:4:9
--> $DIR/pub-reexport-priv-extern-crate.rs:2:9
|
LL | pub use core as reexported_core;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -8,23 +32,6 @@ LL | pub use core as reexported_core;
= 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: 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
|
LL | use foo1::core;
| ^^^^^^^^^^
|
= 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: 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
|
LL | pub use foo2::bar::core;
| ^^^^^^^^^^^^^^^
|
= 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`.