Skip to content

Provide std::error::Error impl for filecheck::Error #5

@dtolnay

Description

@dtolnay

filecheck::Error does not implement std::error::Error, which makes it unergonomic to use with modern error libraries that rely on that impl for error types.

use anyhow::Result;

fn f() -> Result<(), filecheck::Error> {
    Ok(())
}

fn main() -> Result<()> {
    f()?;  // doesn't work
    Ok(())
}
error[E0277]: the trait bound `filecheck::error::Error: std::error::Error` is not satisfied
 --> src/main.rs:8:8
  |
8 |     f()?;  // doesn't work
  |        ^ the trait `std::error::Error` is not implemented for `filecheck::error::Error`
  |
  = note: required because of the requirements on the impl of `std::convert::From<filecheck::error::Error>` for `anyhow::Error`
  = note: required by `std::convert::From::from

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions