Private dependencies in public interface lint rework - #160726
Conversation
|
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.
45652c2 to
73edae4
Compare
This comment has been minimized.
This comment has been minimized.
73edae4 to
3fd82be
Compare
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
@rustbot reroll |
|
I'm not familiar either. @rustbot reroll |
|
Purely from the description, checking for how it is imported and |
|
Right, I've found some cases where this rework doesn't work, it just happened to work for the tests that were here but using fully qualified paths vs imports has effect on whether the lint fires so this is broken. I'll try to rework it so that the needed information is collected I guess in the late pass of resolve. @rustbot label +S-waiting-on-author -S-waiting-on-review |
|
☔ The latest upstream changes (presumably #161043) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
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.