How to create custom `syn::Type` from `TokenStream`?

Hi! Basically I want to do this:

// ...
let ty: Type = input.parse()?;
let new_ty = Type::from(quote!(<#ty as OtherType>::Target));

But obviously I can't use TokenStream produced by quote! as an argument for Type::from. Is there a way to do this?

You can output the literal tokens for <#ty as OtherType>::Target in the result, but you cannot look up what that type actually is because that info has not yet been computed when your macro runs.

1 Like

Oh, that is what I've feared. Seems like I have to just deal with TokenStream.
Thank you for your response.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.