Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl ToTokens for syn::Error and syn::Result<T: ToTokens>? #1784

Open
marcianx opened this issue Nov 21, 2024 · 0 comments
Open

Impl ToTokens for syn::Error and syn::Result<T: ToTokens>? #1784

marcianx opened this issue Nov 21, 2024 · 0 comments

Comments

@marcianx
Copy link

I had a foo: syn::Result<Expr> and wrote:

foo
    .map(ToTokens::into_token_stream)
    .unwrap_or_else(syn::Error::into_compile_error)
    .into()

and it made me wonder:

  1. 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>.
  2. Does it make sense to also implement ToTokens for syn::Error?

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant