New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 'Send' for diesel::result::Error #243

Closed
freiguy1 opened this Issue Mar 25, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@freiguy1

freiguy1 commented Mar 25, 2016

I'm working on a web app using iron and there's a macro itry! which wraps std::error::Errors in iron's IronError (documentation). When attempting to use itry! on a bit of code which returns an error containing a diesel::result::Error I get a nasty warning about implementing Send for an this error:

<iron macros>:7:1: 7:26 error: the trait `core::marker::Send` is not implemented for the type `std::error::Error + 'static` [E0277]
<iron macros>:7 $ crate:: IronError:: new ( err , $ modifier ) ) } )
                ^~~~~~~~~~~~~~~~~~~~~~~~~
<iron macros>:2:1: 2:61 note: in this expansion of itry! (defined in <iron macros>)
src/league/get_by_id.rs:23:5: 23:23 note: in this expansion of itry! (defined in <iron macros>)
<iron macros>:7:1: 7:26 help: run `rustc --explain E0277` to see a detailed explanation
<iron macros>:7:1: 7:26 note: `std::error::Error + 'static` cannot be sent between threads safely
<iron macros>:7:1: 7:26 note: required because it appears within the type `Box<std::error::Error + 'static>`
<iron macros>:7:1: 7:26 note: required because it appears within the type `diesel::result::Error`
<iron macros>:7:1: 7:26 note: required by `iron::error::IronError::new`
error: aborting due to previous error

this happens when trying to use itry!(do_thing()) where do_thing is:

fn do_thing() -> Result<u32, ::diesel::result::Error> {
    Ok(13);
}

Other errors do not show the same behavior even though they don't explicitly implement Send. Perhaps there is something in diesel's Error which isn't thread safe?

@sgrif sgrif closed this in e2d2bf3 Mar 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment