Skip to content

Linter suggestion breaks compilation #53925

Closed
@zakarumych

Description

@zakarumych

I define #![deny(rust_2018_idioms)] which implies #![deny(unreachable_pub)] and I got linter complaining about the pub use inside private module while I reexport the symbol at crate level.

Here is a small example of what I'm talking about

Looks ok. Let's do what linter suggests - change pub to pub(crate) and...
Get compilation error with 'Bar is private'

Here is how it looks like

What is the correct way to export Bar in example? My guess is that second variant is correct, hence linter is correct as well, and the bug is in visibility system somewhere in rustc. But I'm not an expert here.

Metadata

Metadata

Assignees

Labels

A-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions