proc_macro::LexError doesn't implement std::error::Error #68896
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
LexError
, the error type used byproc_macro::TokenStream
'sFromStr
implementation, doesn't implementstd::error::Error
. This makes it very un-ergonomic to work with when trying to use the?
operator to propagate errors in a function that returns a non-specific error type likeBox<dyn std::error::Error>
or theError
type provided by theanyhow
crate.I wrote the following code to demonstrate what I mean:
(Playground)
Errors:
So while this does feel like an easy PR (and if it is, I plan to submit it!), I just wanted to make sure beforehand that there isn't some good reason that this is the case. I've never really worked with procedural macros at all (I noticed this issue through the
proc-macro2
crate) so I'm not sure if there's something special going on here that I'm not aware of. Thanks in advance for the help :)The text was updated successfully, but these errors were encountered: