Skip to content

Instantly share code, notes, and snippets.

@pimeys
Last active September 12, 2019 14:03
Show Gist options
  • Save pimeys/fe2029c1b13e4e14f8968956516f339c to your computer and use it in GitHub Desktop.
Save pimeys/fe2029c1b13e4e14f8968956516f339c to your computer and use it in GitHub Desktop.
error[E0277]: `(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)` cannot be shared between threads safely
--> src/main.rs:104:22
|
104 | app.at("/:name").get(run_query).post(save_query);
| ^^^ `(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)>`
= note: required because it appears within the type `std::boxed::Box<(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)>`
= note: required because it appears within the type `std::pin::Pin<std::boxed::Box<(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)>>`
= note: required because it appears within the type `http_service::Body`
= note: required because it appears within the type `http::request::Request<http_service::Body>`
= note: required because it appears within the type `tide_core::context::Context<server::Server>`
= note: required because of the requirements on the impl of `std::marker::Send` for `&tide_core::context::Context<server::Server>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6> {tide_core::context::Context<server::Server>, std::string::String, &'r tide_core::context::Context<server::Server>, &'s server::Server, server::Server, &'t0 server::Server, &'t1 std::string::String, str, &'t2 str, impl core::future::future::Future, impl core::future::future::Future, ()}`
= note: required because it appears within the type `[static generator@src/main.rs:44:1: 55:2 cx:tide_core::context::Context<server::Server> for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6> {tide_core::context::Context<server::Server>, std::string::String, &'r tide_core::context::Context<server::Server>, &'s server::Server, server::Server, &'t0 server::Server, &'t1 std::string::String, str, &'t2 str, impl core::future::future::Future, impl core::future::future::Future, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:44:1: 55:2 cx:tide_core::context::Context<server::Server> for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6> {tide_core::context::Context<server::Server>, std::string::String, &'r tide_core::context::Context<server::Server>, &'s server::Server, server::Server, &'t0 server::Server, &'t1 std::string::String, str, &'t2 str, impl core::future::future::Future, 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 of the requirements on the impl of `tide_core::endpoint::Endpoint<server::Server>` for `fn(tide_core::context::Context<server::Server>) -> impl core::future::future::Future {run_query}`
error[E0277]: `(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)` cannot be shared between threads safely
--> src/main.rs:104:37
|
104 | app.at("/:name").get(run_query).post(save_query);
| ^^^^ `(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)>`
= note: required because it appears within the type `std::boxed::Box<(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)>`
= note: required because it appears within the type `std::pin::Pin<std::boxed::Box<(dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::io::Error>> + std::marker::Send + 'static)>>`
= note: required because it appears within the type `http_service::Body`
= note: required because it appears within the type `http::request::Request<http_service::Body>`
= note: required because it appears within the type `tide_core::context::Context<server::Server>`
= note: required because of the requirements on the impl of `std::marker::Send` for `&tide_core::context::Context<server::Server>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {tide_core::context::Context<server::Server>, std::string::String, fn(std::result::Result<std::string::String, tide_core::error::types::Error>) -> std::result::Result<<std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::Ok, <std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::Error> {<std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::into_result}, &'r mut tide_core::context::Context<server::Server>, impl core::future::future::Future, impl core::future::future::Future, (), &'t1 tide_core::context::Context<server::Server>, &'t2 server::Server, server::Server, &'t3 server::Server, impl core::future::future::Future, impl core::future::future::Future}`
= note: required because it appears within the type `[static generator@src/main.rs:34:1: 41:2 __arg0:tide_core::context::Context<server::Server> for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {tide_core::context::Context<server::Server>, std::string::String, fn(std::result::Result<std::string::String, tide_core::error::types::Error>) -> std::result::Result<<std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::Ok, <std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::Error> {<std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::into_result}, &'r mut tide_core::context::Context<server::Server>, impl core::future::future::Future, impl core::future::future::Future, (), &'t1 tide_core::context::Context<server::Server>, &'t2 server::Server, server::Server, &'t3 server::Server, impl core::future::future::Future, impl core::future::future::Future}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:34:1: 41:2 __arg0:tide_core::context::Context<server::Server> for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {tide_core::context::Context<server::Server>, std::string::String, fn(std::result::Result<std::string::String, tide_core::error::types::Error>) -> std::result::Result<<std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::Ok, <std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::Error> {<std::result::Result<std::string::String, tide_core::error::types::Error> as std::ops::Try>::into_result}, &'r mut tide_core::context::Context<server::Server>, impl core::future::future::Future, impl core::future::future::Future, (), &'t1 tide_core::context::Context<server::Server>, &'t2 server::Server, server::Server, &'t3 server::Server, impl core::future::future::Future, 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 of the requirements on the impl of `tide_core::endpoint::Endpoint<server::Server>` for `fn(tide_core::context::Context<server::Server>) -> impl core::future::future::Future {save_query}`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
error: Could not compile `blocking-test`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment