Skip to content

Instantly share code, notes, and snippets.

@Mark-Simulacrum
Created July 11, 2019 11:42
Show Gist options
  • Save Mark-Simulacrum/a15a30592c46391aae3bf8931e5ab866 to your computer and use it in GitHub Desktop.
Save Mark-Simulacrum/a15a30592c46391aae3bf8931e5ab866 to your computer and use it in GitHub Desktop.
error[E0277]: `(dyn futures::stream::Stream<Item = hyper::body::chunk::Chunk, Error = std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>> + std::marker::Send + 'static)` cannot be shared between threads safely
--> src/main.rs:118:59
|
118 | service_fn(move |req| serve_req(req, ctx.clone()).boxed().compat())
| ^^^^^ `(dyn futures::stream::Stream<Item = hyper::body::chunk::Chunk, Error = std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>> + std::marker::Send + 'static)` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn futures::stream::Stream<Item = hyper::body::chunk::Chunk, Error = std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>> + std::marker::Send + 'static)`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn futures::stream::Stream<Item = hyper::body::chunk::Chunk, Error = std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>> + std::marker::Send + 'static)>`
= note: required because it appears within the type `std::boxed::Box<(dyn futures::stream::Stream<Item = hyper::body::chunk::Chunk, Error = std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>> + std::marker::Send + 'static)>`
= note: required because it appears within the type `hyper::body::body::Kind`
= note: required because it appears within the type `hyper::body::body::Body`
= note: required because it appears within the type `reqwest::async_impl::body::Inner`
= note: required because it appears within the type `reqwest::async_impl::body::Body`
= note: required because it appears within the type `reqwest::async_impl::decoder::Inner`
= note: required because it appears within the type `reqwest::async_impl::decoder::Decoder`
= note: required because it appears within the type `reqwest::async_impl::response::Response`
= note: required because of the requirements on the impl of `std::marker::Send` for `&reqwest::async_impl::response::Response`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2> {&'r triagebot::github::GithubClient, &'s str, &'t0 str, &'t1 str, std::string::String, reqwest::async_impl::request::RequestBuilder, reqwest::async_impl::request::Request, fn(std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>>) -> std::result::Result<<std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::Ok, <std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::Error> {<std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::into_result}, futures_util::compat::compat01as03::Compat01As03<impl futures::future::Future>, (), reqwest::async_impl::response::Response, &'t2 reqwest::async_impl::response::Response, http::status::StatusCode, std::vec::Vec<u8>, futures_util::stream::into_future::StreamFuture<futures_util::compat::compat01as03::Compat01As03<reqwest::async_impl::decoder::Decoder>>}`
= note: required because it appears within the type `[static generator@DefId(138:140 ~ triagebot[6b8c]::github[0]::{{impl}}[8]::raw_file[0]::{{closure}}[0]) 0:&triagebot::github::GithubClient, 1:&str, 2:&str, 3:&str for<'r, 's, 't0, 't1, 't2> {&'r triagebot::github::GithubClient, &'s str, &'t0 str, &'t1 str, std::string::String, reqwest::async_impl::request::RequestBuilder, reqwest::async_impl::request::Request, fn(std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>>) -> std::result::Result<<std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::Ok, <std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::Error> {<std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::into_result}, futures_util::compat::compat01as03::Compat01As03<impl futures::future::Future>, (), reqwest::async_impl::response::Response, &'t2 reqwest::async_impl::response::Response, http::status::StatusCode, std::vec::Vec<u8>, futures_util::stream::into_future::StreamFuture<futures_util::compat::compat01as03::Compat01As03<reqwest::async_impl::decoder::Decoder>>}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@DefId(138:140 ~ triagebot[6b8c]::github[0]::{{impl}}[8]::raw_file[0]::{{closure}}[0]) 0:&triagebot::github::GithubClient, 1:&str, 2:&str, 3:&str for<'r, 's, 't0, 't1, 't2> {&'r triagebot::github::GithubClient, &'s str, &'t0 str, &'t1 str, std::string::String, reqwest::async_impl::request::RequestBuilder, reqwest::async_impl::request::Request, fn(std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>>) -> std::result::Result<<std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::Ok, <std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::Error> {<std::result::Result<reqwest::async_impl::response::Response, failure::context::Context<std::string::String>> as std::ops::Try>::into_result}, futures_util::compat::compat01as03::Compat01As03<impl futures::future::Future>, (), reqwest::async_impl::response::Response, &'t2 reqwest::async_impl::response::Response, http::status::StatusCode, std::vec::Vec<u8>, futures_util::stream::into_future::StreamFuture<futures_util::compat::compat01as03::Compat01As03<reqwest::async_impl::decoder::Decoder>>}]>`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {&'r triagebot::github::GithubClient, &'s str, fn(std::result::Result<std::vec::Vec<u8>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::into_result}, fn(std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, ()}`
= note: required because it appears within the type `[static generator@DefId(138:35 ~ triagebot[6b8c]::config[0]::get_fresh_config[0]::{{closure}}[0]) 0:&triagebot::github::GithubClient, 1:&str for<'r, 's, 't0, 't1, 't2, 't3> {&'r triagebot::github::GithubClient, &'s str, fn(std::result::Result<std::vec::Vec<u8>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::into_result}, fn(std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@DefId(138:35 ~ triagebot[6b8c]::config[0]::get_fresh_config[0]::{{closure}}[0]) 0:&triagebot::github::GithubClient, 1:&str for<'r, 's, 't0, 't1, 't2, 't3> {&'r triagebot::github::GithubClient, &'s str, fn(std::result::Result<std::vec::Vec<u8>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::vec::Vec<u8>, failure::error::Error> as std::ops::Try>::into_result}, fn(std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::option::Option<std::vec::Vec<u8>>, failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, ()}]>`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2> {&'r triagebot::github::GithubClient, &'s str, for<'t3> fn(&'t3 str) -> std::option::Option<std::sync::Arc<triagebot::config::Config>> {triagebot::config::get_cached_config}, str, &'t0 str, std::option::Option<std::sync::Arc<triagebot::config::Config>>, impl core::future::future::Future, ()}`
= note: required because it appears within the type `[static generator@DefId(138:30 ~ triagebot[6b8c]::config[0]::get[0]::{{closure}}[0]) 0:&triagebot::github::GithubClient, 1:&str for<'r, 's, 't0, 't1, 't2> {&'r triagebot::github::GithubClient, &'s str, for<'t3> fn(&'t3 str) -> std::option::Option<std::sync::Arc<triagebot::config::Config>> {triagebot::config::get_cached_config}, str, &'t0 str, std::option::Option<std::sync::Arc<triagebot::config::Config>>, impl core::future::future::Future, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@DefId(138:30 ~ triagebot[6b8c]::config[0]::get[0]::{{closure}}[0]) 0:&triagebot::github::GithubClient, 1:&str for<'r, 's, 't0, 't1, 't2> {&'r triagebot::github::GithubClient, &'s str, for<'t3> fn(&'t3 str) -> std::option::Option<std::sync::Arc<triagebot::config::Config>> {triagebot::config::get_cached_config}, str, &'t0 str, std::option::Option<std::sync::Arc<triagebot::config::Config>>, impl core::future::future::Future, ()}]>`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1> {&'r triagebot::handlers::Context, &'s triagebot::github::Event, fn(std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, ()}`
= note: required because it appears within the type `[static generator@DefId(138:1030 ~ triagebot[6b8c]::handlers[0]::handle[0]::{{closure}}[0]) 0:&triagebot::handlers::Context, 1:&triagebot::github::Event for<'r, 's, 't0, 't1> {&'r triagebot::handlers::Context, &'s triagebot::github::Event, fn(std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@DefId(138:1030 ~ triagebot[6b8c]::handlers[0]::handle[0]::{{closure}}[0]) 0:&triagebot::handlers::Context, 1:&triagebot::github::Event for<'r, 's, 't0, 't1> {&'r triagebot::handlers::Context, &'s triagebot::github::Event, fn(std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error>) -> std::result::Result<<std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<std::sync::Arc<triagebot::config::Config>, failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, ()}]>`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18> {triagebot::EventName, std::string::String, &'r triagebot::handlers::Context, triagebot::github::IssueCommentEvent, triagebot::github::Event, impl core::future::future::Future, (), std::result::Result<(), failure::error::Error>, failure::error::Error, &'t1 triagebot::github::Event, std::option::Option<&'t2 triagebot::github::Issue>, &'t3 triagebot::github::Issue, triagebot::interactions::ErrorComment<'t4>, fn(std::result::Result<(), failure::error::Error>) -> std::result::Result<<std::result::Result<(), failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<(), failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<(), failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, triagebot::github::IssuesEvent, impl core::future::future::Future, &'t11 triagebot::github::Event, std::option::Option<&'t12 triagebot::github::Issue>, &'t13 triagebot::github::Issue, triagebot::interactions::ErrorComment<'t14>, impl core::future::future::Future}`
= note: required because it appears within the type `[static generator@DefId(138:242 ~ triagebot[6b8c]::webhook[0]::{{closure}}[0]) 0:triagebot::EventName, 1:std::string::String, 2:&triagebot::handlers::Context for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18> {triagebot::EventName, std::string::String, &'r triagebot::handlers::Context, triagebot::github::IssueCommentEvent, triagebot::github::Event, impl core::future::future::Future, (), std::result::Result<(), failure::error::Error>, failure::error::Error, &'t1 triagebot::github::Event, std::option::Option<&'t2 triagebot::github::Issue>, &'t3 triagebot::github::Issue, triagebot::interactions::ErrorComment<'t4>, fn(std::result::Result<(), failure::error::Error>) -> std::result::Result<<std::result::Result<(), failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<(), failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<(), failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, triagebot::github::IssuesEvent, impl core::future::future::Future, &'t11 triagebot::github::Event, std::option::Option<&'t12 triagebot::github::Issue>, &'t13 triagebot::github::Issue, triagebot::interactions::ErrorComment<'t14>, impl core::future::future::Future}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@DefId(138:242 ~ triagebot[6b8c]::webhook[0]::{{closure}}[0]) 0:triagebot::EventName, 1:std::string::String, 2:&triagebot::handlers::Context for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18> {triagebot::EventName, std::string::String, &'r triagebot::handlers::Context, triagebot::github::IssueCommentEvent, triagebot::github::Event, impl core::future::future::Future, (), std::result::Result<(), failure::error::Error>, failure::error::Error, &'t1 triagebot::github::Event, std::option::Option<&'t2 triagebot::github::Issue>, &'t3 triagebot::github::Issue, triagebot::interactions::ErrorComment<'t4>, fn(std::result::Result<(), failure::error::Error>) -> std::result::Result<<std::result::Result<(), failure::error::Error> as std::ops::Try>::Ok, <std::result::Result<(), failure::error::Error> as std::ops::Try>::Error> {<std::result::Result<(), failure::error::Error> as std::ops::Try>::into_result}, impl core::future::future::Future, triagebot::github::IssuesEvent, impl core::future::future::Future, &'t11 triagebot::github::Event, std::option::Option<&'t12 triagebot::github::Issue>, &'t13 triagebot::github::Issue, triagebot::interactions::ErrorComment<'t14>, impl core::future::future::Future}]>`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0> {http::request::Request<hyper::body::body::Body>, std::sync::Arc<triagebot::handlers::Context>, http::request::Parts, hyper::body::body::Body, triagebot::EventName, &'r str, futures_util::compat::compat01as03::Compat01As03<hyper::body::body::Body>, std::vec::Vec<u8>, futures_util::stream::next::Next<'s, futures_util::compat::compat01as03::Compat01As03<hyper::body::body::Body>>, (), std::string::String, impl core::future::future::Future}`
= note: required because it appears within the type `[static generator@src/main.rs:14:99: 101:2 req:http::request::Request<hyper::body::body::Body>, ctx:std::sync::Arc<triagebot::handlers::Context> for<'r, 's, 't0> {http::request::Request<hyper::body::body::Body>, std::sync::Arc<triagebot::handlers::Context>, http::request::Parts, hyper::body::body::Body, triagebot::EventName, &'r str, futures_util::compat::compat01as03::Compat01As03<hyper::body::body::Body>, std::vec::Vec<u8>, futures_util::stream::next::Next<'s, futures_util::compat::compat01as03::Compat01As03<hyper::body::body::Body>>, (), std::string::String, impl core::future::future::Future}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:14:99: 101:2 req:http::request::Request<hyper::body::body::Body>, ctx:std::sync::Arc<triagebot::handlers::Context> for<'r, 's, 't0> {http::request::Request<hyper::body::body::Body>, std::sync::Arc<triagebot::handlers::Context>, http::request::Parts, hyper::body::body::Body, triagebot::EventName, &'r str, futures_util::compat::compat01as03::Compat01As03<hyper::body::body::Body>, std::vec::Vec<u8>, futures_util::stream::next::Next<'s, futures_util::compat::compat01as03::Compat01As03<hyper::body::body::Body>>, (), std::string::String, impl core::future::future::Future}]>`
= note: required because it appears within the type `impl core::future::future::Future`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment