Closed
Description
Making an issue off of my email to the mailing list.
Currently today resolve is generally considered "broken", and I think that this would benefit from actually writing the rules down, writing lots of test cases and documentation, and then fixing resolve. To the best of my knowledge, these are the rules which resolve should follow for determining whether an item is public or private and whether a certain path should resolve or not:
- All items are private by default, with the exception of struct fields.
To flag an item as public, you usepub
. Alsopub
is not allowed onimpl
orextern
(visibility is determined by each item individually). - For a path which is a cross-crate reference, it is only valid of every
item in the path is marked aspub
. - A module may access any item from its immediate parent.
- A module may access any item from its immediate children.
- Any local-crate path which goes outside the bounds of 3/4 will only resolve
if each component of the path ispub
. For example I could reach into a
child's private mod's pub items, but not the child's private mod's non-pub
items.
I'm nominating for a backwards-compatibility milestone as there's probably lots of existing code which is doing the wrong thing by accident.
Metadata
Metadata
Assignees
Labels
No labels