Revisiting modules, take 3

To be clear, this rule exists today: Rust Playground

The reason is to help with reasoning about unsafe code. If you are using a privacy boundary to control safety, you want to know that the boundary is not a lie.

We've called this the "less than or equal to" rule - all items are no more visible than their stated visibility. This RFC brings us into an "equal to" rule - all items are as visible as they state they are (though, with export items, possibly not at this location).

1 Like

Re: use being an item or not, I can understand the concern about breaking yet another thing unnecessarily. On the other hand, "use is an item" was introduced to make pub use consistent with other items. If pub use is deprecated, then not only is the motivation for "use is an item" gone, but now use is inconsistent with other named items because it doesn’t support visibility. It’s somewhat unfortunate to end up with an inconsistency as an artefact of trying to make a previous iteration of the language consistent.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.