I have a struct
with a non 'static
lifetime, this sruct
is then used by enum
that represents my error:
#[derive(Debug, Fail)]
pub enum ParserError<'a> {
#[fail(display = "Unexpected [{}] got {}", _1, _0)]
ExpectedAGotB(Token<'a>, TokenKindExpectedOptions<'a>),
}
Because of failure
's requirement of 'static
lifetime for #[derive(Failre)]
I'm getting this error:
error[E0478]: lifetime bound not satisfied
--> src/lib/ra_parser/src/errors.rs:18:17
|
18 | #[derive(Debug, Fail)]
| ^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined on the impl at 19:22
--> src/lib/ra_parser/src/errors.rs:19:22
|
19 | pub enum ParserError<'a> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
What's my strategy to solve this? Is there way to make Token<'static>
, perhaps not. Should I impl
something myself?