Closed
Description
openedon Oct 20, 2022
Given the following code:
#[warn(unreachable_pub)]
mod inner {
#[allow(unused)]
pub enum T {
A(u32),
}
}
The current output is:
warning: unreachable `pub` item
--> src/main.rs:4:5
|
4 | pub enum T {
| ---^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
note: the lint level is defined here
--> src/main.rs:1:8
|
1 | #[warn(unreachable_pub)]
| ^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
warning: unreachable `pub` field
--> src/main.rs:5:11
|
5 | A(u32),
| -^^
| |
| help: consider restricting its visibility: `pub(crate)`
Which basically brokes cargo-fix, i.e cargo fix --broken-code
produces invalid code:
#[warn(unreachable_pub)]
mod inner {
#[allow(unused)]
pub(crate) enum T {
A(pub(crate)u32),
}
}
That seems to affect any enum with variant fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsRelevant 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.