diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-17 00:26:00 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-17 00:40:37 +0800 |
| commit | 1cd4a824b3bffbbdf391837288921d538438a751 (patch) | |
| tree | a8ea0cf092d7862d15018e434c0af9707a67db94 /docs/dev/pages/issues/t1_pathf-export-macro.md | |
| parent | 62d2f8637da3274fc22debb62b79f15e521d503e (diff) | |
docs: split 0.5.0 roadmap into individual issue pages
Diffstat (limited to 'docs/dev/pages/issues/t1_pathf-export-macro.md')
| -rw-r--r-- | docs/dev/pages/issues/t1_pathf-export-macro.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/docs/dev/pages/issues/t1_pathf-export-macro.md b/docs/dev/pages/issues/t1_pathf-export-macro.md new file mode 100644 index 0000000..0a98485 --- /dev/null +++ b/docs/dev/pages/issues/t1_pathf-export-macro.md @@ -0,0 +1,53 @@ +<h1 align="center">[T1] The pathf_export Attribute Macro</h1> +<p align="center"> + Feature: an escape hatch for <code>pathf</code>'s path inference +</p> + +## Background + +`pathf` has been around since 0.2.0 and has worked well for a long time, with many edge cases resolved. However, it still lacks an escape hatch — "when certain indirect expansions cannot be recognized by `pathf`, how can we assist its inference?" + +For example, when a Mingling type is created through a user-defined `macro_rules!` wrapper, `pathf` cannot see through the indirect expansion: + +```rust +#[macro_export] +macro_rules! repack { + ($name:ident) => { + // Ignored! This section cannot be parsed by pathf. + #[mingling::macros::pathf_ignore] + #[derive(mingling::Grouped)] + pub struct $name; + }; +} + +// The expansion contains macros that need to be parsed by pathf +#[pathf_export(MyType)] // Explicitly specified to assist pathf's inference +repack!(MyType); +``` + +> [!Note] +> Haha, hopefully we'll never have to use it. + +## Plan + +Introduce a new attribute macro, `#[pathf_export(type::TypePath)]`, to supplement `pathf`'s path inference. When applied to an item whose expansion contains Mingling types that `pathf` cannot recognize, it explicitly records the resulting type paths so the build-time analyzer can pick them up. + +The example above also shows `#[mingling::macros::pathf_ignore]`, which marks an item to be skipped by `pathf` (used inside macro bodies that `pathf` otherwise cannot parse). + +## Tasks + +- [ ] Design the `pathf_export` syntax and semantics (attribute position, multiple type paths, interplay with `pathf_ignore`) +- [ ] Implement `pathf_export` in `mingling_macros` +- [ ] Implement `pathf_ignore` support in `mingling_macros` +- [ ] Teach `mingling-pathf` to consume the exported mappings +- [ ] Add tests covering indirect macro expansions +- [ ] Update docs and examples + +## 🕘 Progress + +- [ ] In Progress +- [ ] Complete + +<p align="center" style="font-size: 0.85em; color: gray;"> + Written by @Weicao-CatilGrass +</p> |
