-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-unreachable_pubLint: unreachable_pubLint: unreachable_pubT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
First reported upstream, this code:
#![warn(unreachable_pub)]
#![deny(unused_imports)]
pub mod core {
pub mod compiler {
mod context {
mod compilation_files {
pub struct Metadata;
pub struct CompilationFiles;
impl CompilationFiles {
pub fn metadata() -> Metadata { Metadata }
}
}
use self::compilation_files::CompilationFiles;
pub use self::compilation_files::Metadata; // Suggests pub(crate)
// but that causes unused_imports to complain.
pub struct Context;
impl Context {
pub fn files() -> CompilationFiles { CompilationFiles }
}
}
pub use self::context::Context;
}
}
warning: unreachable `pub` item
--> src/lib.rs:15:13
|
15 | pub use self::compilation_files::Metadata; // Suggests pub(crate)
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
note: lint level defined here
--> src/lib.rs:1:9
|
1 | #![warn(unreachable_pub)]
| ^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` item
--> src/lib.rs:15:21
|
15 | pub use self::compilation_files::Metadata; // Suggests pub(crate)
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
= help: or consider exporting it for use by other crates
but the suggested fix doesn't compile!
msrd0
Metadata
Metadata
Assignees
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-unreachable_pubLint: unreachable_pubLint: unreachable_pubT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.