Skip to content

Restrict TypeSpace::break_cycles to crate visibility#1029

Open
danieleades wants to merge 1 commit into
oxidecomputer:mainfrom
danieleades:fix/break-cycles-visibility
Open

Restrict TypeSpace::break_cycles to crate visibility#1029
danieleades wants to merge 1 commit into
oxidecomputer:mainfrom
danieleades:fix/break-cycles-visibility

Conversation

@danieleades

Copy link
Copy Markdown
Contributor

What

Changes TypeSpace::break_cycles from pub to pub(crate).

Why

break_cycles lives in the private cycles module, but inherent-impl method visibility ignores module privacy, so the pub marker made it part of typify-impl's public API (it shows up on docs.rs). The method takes a raw Range<u64> of internal type IDs, so it can't be used meaningfully by external callers, and invoking it with arbitrary ranges could corrupt the type space. All call sites are internal to the crate.

Notes

  • Technically this is a semver-visible API removal, so it should land in a minor/breaking release rather than a patch — but the method has no legitimate external use.
  • grep -rn break_cycles confirms the only caller is in typify-impl/src/lib.rs; nothing in the typify facade crate, typify-macro, or cargo-typify uses it.
  • Full workspace test suite passes.

break_cycles is an internal helper that operates on raw ranges of
internal type IDs. It was unintentionally exposed as public API:
inherent-impl method visibility ignores module privacy, so `pub` in
the private cycles module made it visible to external callers. It
cannot be used meaningfully outside the crate, and calling it with
arbitrary ranges could corrupt the type space. All call sites are
internal, so mark it pub(crate).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant