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

Consider adding Error::into_compile_error #702

Closed
dtolnay opened this issue Aug 25, 2019 · 1 comment
Closed

Consider adding Error::into_compile_error #702

dtolnay opened this issue Aug 25, 2019 · 1 comment

Comments

@dtolnay
Copy link
Owner

dtolnay commented Aug 25, 2019

This is commonly useful when lowering Result<TokenStream> to TokenStream.

// before
fallible(input)
    .unwrap_or_else(|err| err.to_compile_error())

// after
fallible(input)
    .unwrap_or_else(Error::into_compile_error)
@CreepySkeleton
Copy link
Contributor

Honestly, I don't see much difference between the two.

Maybe we should attach .unwrap_or_compile_error() to Result<TokenStream, syn::Error> instead?

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

2 participants