TGViewer
Блог* Блог* @dereference_pointer_there · 1.98K subscribers
Post #10866 1.13K
#prog #rust #rustlib #article

🦀Building Rust Procedural Macros Without quote!: Introducing zyn

I've been writing proc macros for a while now. Derive macros for internal tools, attribute macros for instrumentation. And every time, the same two problems: quote! doesn't compose (you end up passing TokenStream fragments through five layers of helper functions and writing hundreds of let statements), and debugging generated code means cargo expand and then squinting at unformatted token output hoping something jumps out.

Because of this I ended up writing the same helper methods, composite AST parsing and tokenizing types, extractors etc. I would have to copy these from project to project as needed, and eventually just decided to publish a crate so I never have to do it again.

So I built zyn — a proc macro framework with a template language, composable components, and compile-time diagnostics.


I wrote the debug system after spending two days on a bug where a generated impl block was missing a lifetime bound. cargo expand spat out 400 lines of tokens and I couldn't find it, so I built a debug system.
  • 🤔 5
  • ❤ 1
  • 👍 1
  • 🤡 1
More from @dereference_pointer_there
  1. Oct 8, 2026#meme про... Свиней
  2. Oct 8, 2026💩
  3. Oct 8, 2026BTW через 4 часа заканчивается распродажа в Steam
  4. Oct 7, 2026#meme про jab
  5. Oct 7, 2026"Famous car"
  6. Oct 7, 2026photo post
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →