Generating a proc macro reference in a proc macro

I want to create a proc macro crate that generates some things on top of async-trait. If I for some reason would like to treat async-trait as an implementation detail and hide it from the user (i.e. not require them to add it themselves), it is possible for my own proc macro to use async-trait without duplicating its functionality?

I assume it isn't possible to just insert a #[async_trait::async_trait] node somewhere in my proc macro, and have the compiler reevaluate the output?

Is just calling it as a library, from one's own library, a thing?

This should be possible - compiler expands macros iteratively, until there's no one left.

2 Likes