-   Notifications  You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-edition-2018Area: The 2018 editionArea: The 2018 editionF-rust_2018_preview`#![feature(rust_2018_preview)]``#![feature(rust_2018_preview)]`
Description
Given code that looks like:
mod foo { pub struct Bar; pub struct Baz; } mod bar { pub use foo::{Bar, Baz}; }you get:
$ rustc +nightly src/lib.rs --crate-type lib -W rust_2018_idioms warning: struct is never used: `Bar` --> src/lib.rs:2:5 | 2 | pub struct Bar; | ^^^^^^^^^^^^^^^ | = note: #[warn(dead_code)] on by default warning: struct is never used: `Baz` --> src/lib.rs:3:5 | 3 | pub struct Baz; | ^^^^^^^^^^^^^^^ warning: unreachable `pub` item --> src/lib.rs:2:5 | 2 | pub struct Bar; | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = note: `-W unreachable-pub` implied by `-W rust-2018-idioms` = help: or consider exporting it for use by other crates warning: unreachable `pub` item --> src/lib.rs:3:5 | 3 | pub struct Baz; | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates warning: unreachable `pub` item --> src/lib.rs:7:19 | 7 | pub use foo::{Bar, Baz}; | ^^^ help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates warning: unreachable `pub` item --> src/lib.rs:7:24 | 7 | pub use foo::{Bar, Baz}; | ^^^ help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates which when auto-fixed by cargo fix will produce:
mod foo { pub(crate) struct Bar; pub(crate) struct Baz; } mod bar { pub use foo::{pub(crate), pub(crate)}; }which fails to compile!
cc @Manishearth
kennytm
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-edition-2018Area: The 2018 editionArea: The 2018 editionF-rust_2018_preview`#![feature(rust_2018_preview)]``#![feature(rust_2018_preview)]`