Private dependencies in public interface lint rework - #160726
Open
mladedav wants to merge 5 commits into
Open
Conversation
Collaborator
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
mladedav
force-pushed
the
dm/public-dependencies-shallow
branch
from
August 8, 2026 05:38
45652c2 to
73edae4
Compare
This comment has been minimized.
This comment has been minimized.
mladedav
force-pushed
the
dm/public-dependencies-shallow
branch
from
August 8, 2026 06:32
73edae4 to
3fd82be
Compare
Collaborator
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
Member
|
@rustbot reroll |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking issue: #44663
Closes #119428
This reworks the lint so that it does not fire based on where an item is defined but based on how it is imported. I think this is best illustrated in the following test:
tests/ui/privacy/pub-priv-dep/diamond_deps.rs
The test here is edited for brevity. Note that
Sharedis the same type and the lint fires only when imported through the private dependency.This is my first contribution of this scope and as such, I'm not sure about several things I did:
is_private_depis not enough since it handles transitively public dependencies as publicprivate_depso I just did the same things I've seen there.tcx.hir_module_items(mod_id).par_items(..)instead oftcx.hir_visit_all_item_likes_in_cratePrivateItemsInPublicInterfacesCheckerbe trimmed down more so that there are not two passes for this? It still emits hard errors for types in associated types and I'm not sure how to check for this with the visitor.@epage I'd appreciate if you could check the test changes in the first commit. The state now is how I understand the desired state based on the discussion in #119428 but I'd rather get a final ok on this.