You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why can't we just do quote! { #foo } given that syn::Error has an idiomatic conversion to a TokenStream -- IOW, implement ToTokens for syn::Result<T: ToTokens>.
Does it make sense to also implement ToTokens for syn::Error?
Thoughts?
The text was updated successfully, but these errors were encountered:
I think this would be a similar design mistake as Serde implementing Serialize and Deserialize for Result<T, E>. The way it would play out in practice is the intentional uses would be rare and the mistaken uses (someone wrote too few ?) would be rampant and hard to identify. I think .unwrap_or_else(syn::Error::into_compile_error) is the right level of easy and clear for the cases where this is the behavior someone wants.
I had a
foo: syn::Result<Expr>
and wrote:and it made me wonder:
quote! { #foo }
given thatsyn::Error
has an idiomatic conversion to aTokenStream
-- IOW, implementToTokens
forsyn::Result<T: ToTokens>
.ToTokens
forsyn::Error
?Thoughts?
The text was updated successfully, but these errors were encountered: