-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.T-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
This code (playground) trips unreachable_pub
lint (while being completely legit).
#![deny(unreachable_pub)]
pub use self::m1::{Item1, Item2};
mod m1 {
pub use self::m2::{Item1, Item2};
mod m2 {
pub struct Item1;
pub struct Item2;
}
}
However, if we break the top-level pub use ...
statement into two separate statements (playground) - unreachable_pub
lint convinces itself that the code is, indeed, legit.
#![deny(unreachable_pub)]
pub use self::m1::Item1;
pub use self::m1::Item2;
mod m1 {
pub use self::m2::{Item1, Item2};
mod m2 {
pub struct Item1;
pub struct Item2;
}
}
jyn514, jhpratt, yoshuawuyts, Dushistov, TehUncleDolan and 4 more
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.T-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.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-]Lint `unreachable_pub` got easily confused by multiple items in single `pub use ...` statement[/-][+]Lint `unreachable_pub` got easily confused by multiple items in a single `pub use ...` statement[/+]jhpratt commentedon Nov 13, 2019
Running into this myself. Right now I'm just
#[allow]
ing it with a link to this issue.If someone could lead me in the right direction, I'll give fixing this a shot.
197g commentedon Dec 19, 2019
It also gets confused if the export happens via a glob, also on a single item (Playground).
Added unreachable_pub lint to prevent the PlayerEvents issue from reo…
Player::events
but not re-exported. Mange/mpris-rs#48Fix PlayerEvents not being reachable from root
jyn514 commentedon Feb 28, 2020
Looks like this is because of #57922 (comment)
Fix some top-level items being missing
4 remaining items
lambinoo commentedon Jul 11, 2021
@rustbot claim
lambinoo commentedon Jul 19, 2021
Since I claimed it 8 days ago, just a follow up.
I've been able to break the compiler a few times but I'm getting somewhere I think...
Not to a proper solution tho, just more mess, but that means more knowledge!
tl;dr: I haven't given up!
petrochenkov commentedon Jul 20, 2021
How to fix this: #82064.
HirId
s withLocalDefId
s inAccessLevels
tables #87568rustc
wanted features & bugfixes Rust-for-Linux/linux#355Auto merge of rust-lang#87487 - lambinoo:I-64762_unreachable_pub_lint…
lambinoo commentedon Jan 10, 2022
Closed by #87487