{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreicygav4vq2dc6t6elddovc66hcvztrsxtnxenspz6twyk5kl5ehde",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mlaavans6wp2"
  },
  "path": "/t/pre-rfc-pub-api-visibility-and-static-enforcement-of-crate-internal-api-boundaries/24184#post_13",
  "publishedAt": "2026-05-07T03:03:07.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "ActuallyHappening:\n\n> Also, given `mod api`, you can always add another private module layer (e.g. `imp` or `_api`) and export the \"api surface\" all in the `api` module top level, guaranteeing only symbols named there are exported as the API surface. This pattern can already uphold the refactoring issues you've presented (to my understanding?), it just adds more lines of code.\n\nI suppose that's fair. I do try to do that in most of my crates, where the top-level API crate is just a bunch of `pub use`es on private subcrates. I think I'd still prefer if there was a more explicit way of saying what the visibility was that was kept in sync with the API module visibility, but still, fair.\n\nI'm slowly recalling my collection of motivations. Another one is that I often want to have docs for my own internal code that only show intentional API. From the Pre-RFC:\n\n> `rustdoc` can provide improved internal documentation by using the API boundaries as starting points. Right now, the option `--document_private_items` documents all items in a crate, not only those that cross an API boundary. By defining the internal API boundaries, there is a clear subset of items that should be exposed within internal documentation.\n\nIt's true that this could also be a minor update to rustdoc, but I would want to make it clear that it should be used in a mode that lets you specify which modules are supposed to have docs generated for them, and that there is a way to only show documentation for items that would go through that module boundary (and not private items, or items that have visibility below that module).",
  "title": "Pre-RFC: `pub(api)` visibility, and static enforcement of crate-internal API boundaries"
}