Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter suggestion breaks compilation #53925

Closed
zakarumych opened this issue Sep 3, 2018 · 1 comment · Fixed by #57922
Closed

Linter suggestion breaks compilation #53925

zakarumych opened this issue Sep 3, 2018 · 1 comment · Fixed by #57922
Assignees
Labels
A-edition-2018-lints Area: Lints supporting the 2018 edition A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`

Comments

@zakarumych
Copy link
Contributor

zakarumych commented Sep 3, 2018

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.

@zackmdavis
Copy link
Member

The unreachable-pub lint was removed from the 2018-idioms lint group in #52926 because it suffers from the bugs #47816 (which is the cause of the problem in your first example) and #52665, but this change won't be in stable until 1.29 (13 September). Until we have a release candidate, the nightly toolchain might be a better choice for testing out edition-2018 features.

@estebank estebank added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-edition-2018-lints Area: Lints supporting the 2018 edition A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Jan 19, 2019
@davidtwco davidtwco self-assigned this Jan 26, 2019
Centril added a commit to Centril/rust that referenced this issue Jan 28, 2019
Update visibility of intermediate use items.

Fixes rust-lang#57410 and fixes rust-lang#53925 and fixes rust-lang#47816.

Currently, the target of a use statement will be updated with
the visibility of the use statement itself (if the use statement was
visible).

This PR ensures that if the path to the target item is via another
use statement then that intermediate use statement will also have the
visibility updated like the target. This silences incorrect
`unreachable_pub` lints with inactionable suggestions.
bors added a commit that referenced this issue Feb 3, 2019
Update visibility of intermediate use items.

Fixes #57410 and fixes #53925 and fixes #47816.

Currently, the target of a use statement will be updated with
the visibility of the use statement itself (if the use statement was
visible).

This PR ensures that if the path to the target item is via another
use statement then that intermediate use statement will also have the
visibility updated like the target. This silences incorrect
`unreachable_pub` lints with inactionable suggestions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018-lints Area: Lints supporting the 2018 edition A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants