error-chain icon indicating copy to clipboard operation
error-chain copied to clipboard

Lifetime parameters

Open yberreby opened this issue 9 years ago • 1 comments
trafficstars

I'm trying to use error-chain in the context of a simple Lisp interpreter. One of the errors I want to handle has a lifetime parameter, but error-chain does not seem to offer a way to specify generic lifetime parameters. Is it possible?

/// LALRPOP parse error.
pub type LPParseError<'input> = ::lalrpop_util::ParseError<usize, (usize, &'input str), ()>;

// 'input should be declared somewhere around here.
error_chain!{
    errors {
        ParseError(e: LPParseError<'input>) {
            description("failed to parse")
            display("parse error: '{}'", e)
        }
    }
}
error[E0261]: use of undeclared lifetime name `'input`
 --> errors.rs:8:36
  |
8 |         ParseError(e: LPParseError<'input>) {
  |                                    ^^^^^^ undeclared lifetime

yberreby avatar Sep 24 '16 13:09 yberreby

See https://github.com/tailhook/quick-error/issues/20

Yamakaky avatar Nov 17 '16 02:11 Yamakaky