Skip to content

support wrapping error_chain Error's ? / document that Send+Sync are required on top of std::error::Error #72

Closed
@rbtcollins

Description

@rbtcollins

Anyhow claims to support wrapping any implementor of std::error::Error, but error_chain's impl seems incompatible:

error[E0277]: `(dyn std::error::Error + std::marker::Send + 'static)` cannot be shared between threads safely
  --> src/cli/main.rs:66:25
   |
66 |     utils::current_dir()?;
   |                         ^ `(dyn std::error::Error + std::marker::Send + 'static)` cannot be shared between threads safely
   |
   = help: the trait `std::marker::Sync` is not implemented for `(dyn std::error::Error + std::marker::Send + 'static)`
   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn std::error::Error + std::marker::Send + 'static)>`
   = note: required because it appears within the type `std::boxed::Box<(dyn std::error::Error + std::marker::Send + 'static)>`
   = note: required because it appears within the type `std::option::Option<std::boxed::Box<(dyn std::error::Error + std::marker::Send + 'static)>>`
   = note: required because it appears within the type `error_chain::State`
   = note: required because it appears within the type `rustup::errors::Error`
   = note: required because of the requirements on the impl of `std::convert::From<rustup::errors::Error>` for `anyhow::Error`
   = note: required by `std::convert::From::from`

rust-lang-deprecated/error-chain#240 is presumably the underlying cause, but perhaps anyhow could do something on it's end via specialisation or using ?Send and ?Sync or something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions