Pre-RFC: `pub(api)` visibility, and static enforcement of crate-internal API boundaries
pub(in path) had to have in added because pub(not_a_keyword) was ambiguous (in struct definitions? I don't remember the exact syntax quirk). It probably blocks pub(api) too. You might have something with a keyboard like variations of pub(in mod) or pub(super api).
The
pubvisibility is only supposed to be used for items (types, traits, functions, etc.) that are part of the public API of the crate , not the module.
That's not accurate. pub is for the module. It is unfortunately ambiguous (not locally explicit) whether pub means it's part of the crate's public-public API or not.
And I'm disappointed that your proposal isn't the pub to clarify that reachability for pub items. I'd expect pub(api) to be that "absolutely definitely externally pub from outside of the crate", rather than a syntax sugar for internal non-public pub(in path) with a new invention for avoiding repeating the path.
Couldn't you replace !#[api] with use crate::something as api and use pub(in api)?
Discussion in the ATmosphere