Skip to content

Make macro dependencies alias-safe#1052

Open
danieleades wants to merge 2 commits into
oxidecomputer:mainfrom
danieleades:agent/macro-runtime-reexports
Open

Make macro dependencies alias-safe#1052
danieleades wants to merge 2 commits into
oxidecomputer:mainfrom
danieleades:agent/macro-runtime-reexports

Conversation

@danieleades

@danieleades danieleades commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • route all built-in generated-code dependencies through hidden typify re-exports when using import_types!
  • resolve the downstream Cargo name for typify, including dependency aliases
  • configure Serde derives with the re-exported crate path
  • gate macro-only dependencies behind the macro feature and disable that feature for generator-only workspace consumers
  • add a downstream compile fixture that aliases typify and declares no peer dependencies

Context

This follows the approach proposed by @jeffs in #1009 and makes it comprehensive. That PR handled regress (only) this version applies the same policy to chrono, regress, serde, serde_json, and uuid, while also accounting for Cargo dependency aliases and Serde derive expansion.

Generated code previously used hard-coded absolute crate paths. Macro consumers therefore needed direct dependencies on Typify's implementation crates, and routing through ::typify alone would fail when the package was imported under a different name.

Standalone TypeSpace, build.rs, and cargo-typify output retains the existing direct crate paths.

User impact

Consumers of typify::import_types! only need to declare typify for built-in generated types. Renaming that dependency in Cargo.toml is supported. User-specified replacement types, conversions, and additional derives still require their own dependencies.

@danieleades
danieleades marked this pull request as ready for review July 21, 2026 08:38
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