rust-lang-deprecated / error-chain

Error boilerplate for Rust
Apache License 2.0
729 stars 111 forks source link

Lifetime parameters #48

Open yberreby opened 7 years ago

yberreby commented 7 years ago

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
Yamakaky commented 7 years ago

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