Skip to content

Instantly share code, notes, and snippets.

@felipesere
Created September 29, 2019 13:49
Show Gist options
  • Save felipesere/1e9e6bcf5b9fff446afc6d0f08ee61f3 to your computer and use it in GitHub Desktop.
Save felipesere/1e9e6bcf5b9fff446afc6d0f08ee61f3 to your computer and use it in GitHub Desktop.
Error I get when combining clap, runtime, surf, and async/await
error[E0277]: `std::rc::Rc<(dyn for<'r> std::ops::Fn(&'r std::ffi::OsStr) -> std::result::Result<(), std::ffi::OsString> + 'static)>` cannot be sent between threads safely
--> src/main.rs:115:1
|
115 | #[runtime::main]
| ^^^^^^^^^^^^^^^^ `std::rc::Rc<(dyn for<'r> std::ops::Fn(&'r std::ffi::OsStr) -> std::result::Result<(), std::ffi::OsString> + 'static)>` cannot be sent between threads safely
|
::: /Users/felipesere/.cargo/registry/src/github.com-1ecc6299db9ec823/runtime-raw-0.3.0-alpha.5/src/lib.rs:60:29
|
60 | F: Future<Output = T> + Send + 'static,
| ---- required by this bound in `runtime_raw::enter`
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<(dyn for<'r> std::ops::Fn(&'r std::ffi::OsStr) -> std::result::Result<(), std::ffi::OsString> + 'static)>`
= note: required because it appears within the type `std::option::Option<std::rc::Rc<(dyn for<'r> std::ops::Fn(&'r std::ffi::OsStr) -> std::result::Result<(), std::ffi::OsString> + 'static)>>`
= note: required because it appears within the type `clap::args::arg_builder::valued::Valued<'_, '_>`
= note: required because it appears within the type `clap::args::arg::Arg<'_, '_>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {clap::args::arg::Arg<'r, 's>, clap::args::arg_matches::ArgMatches<'t0>, &'t1 str, Command, Config, &'t2 AdvisorApp, fn(std::string::String) -> impl std::future::Future {get}, &'t3 AdvisorApp, std::string::String, impl std::future::Future, ()}`
= note: required because it appears within the type `[static generator@src/main.rs:115:1: 115:17 for<'r, 's, 't0, 't1, 't2, 't3> {clap::args::arg::Arg<'r, 's>, clap::args::arg_matches::ArgMatches<'t0>, &'t1 str, Command, Config, &'t2 AdvisorApp, fn(std::string::String) -> impl std::future::Future {get}, &'t3 AdvisorApp, std::string::String, impl std::future::Future, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:115:1: 115:17 for<'r, 's, 't0, 't1, 't2, 't3> {clap::args::arg::Arg<'r, 's>, clap::args::arg_matches::ArgMatches<'t0>, &'t1 str, Command, Config, &'t2 AdvisorApp, fn(std::string::String) -> impl std::future::Future {get}, &'t3 AdvisorApp, std::string::String, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `{fn() -> impl std::future::Future {main::main}, impl std::future::Future, ()}`
= note: required because it appears within the type `[static generator@src/main.rs:115:1: 115:17 {fn() -> impl std::future::Future {main::main}, impl std::future::Future, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:115:1: 115:17 {fn() -> impl std::future::Future {main::main}, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment