feat: add #[stageleft::export(Foo, Bar)] to pub-export macro-generated items#49
Conversation
…-generated items
|
I guess this macro can also apply to other items (not just macros) e.g. a struct macro that has some attributes which generate a newtype (like buildstructor perhaps), ill add those code paths too maybe Edit: actually I will punt this to later. see branch #50 https://github.com/hydro-project/stageleft/tree/stageleft-export-macro-2 |
There was a problem hiding this comment.
Pull request overview
This PR adds a new #[stageleft::export(...)] attribute macro that allows marking macro invocations that generate one or more pub items. This prevents "splitbrain" issues where macro-generated types are re-invoked in staged code, causing type mismatches between the original and staged versions.
Changes:
- Adds
#[stageleft::export(...)]attribute macro to mark macro invocations that generate public items - Implements build-time code generation to replace marked macros with re-exports in staged code
- Adds a new test package
stageleft_test_no_entryto verify the functionality - Includes compile-fail test to ensure exported items must be public
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| stageleft_macro/src/lib.rs | Implements the new export attribute macro that validates and marks macro-generated items |
| stageleft_tool/src/lib.rs | Adds logic to detect stageleft::export attributes and replace marked macros with re-exports in staged code |
| stageleft/src/lib.rs | Exports the new export macro to make it publicly available |
| stageleft_test_no_entry/* | New test package demonstrating the export feature with slotmap's new_key_type! macro |
| stageleft/tests/compile-fail/* | Compile-fail test ensuring exported items must be pub |
| Cargo.toml, Cargo.lock, stageleft/Cargo.toml | Adds new test package and slotmap dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.