@chrisd could you share some more code? I've been working on proc-macros in the last two days (and asked my fair share of questions here ), but @dtolnay kindly helped me out, and things are working as expected for me.
Of note is that dyn uses the proc_macro2 crate internally. When you write a function-like procedural macro, you get a proc_macro::TokenStream, and need to return a proc_macro::TokenStream.
proc_macro2::TokenStream implements From<proc_macro::TokenStream>, so you can use into() to go back to a regular proc_macro::TokenStream before you return it from your macro function.