Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created September 12, 2019 09:18
Show Gist options
  • Save pimeys/33e9b189a247766bfec3c5a510e45443 to your computer and use it in GitHub Desktop.
Save pimeys/33e9b189a247766bfec3c5a510e45443 to your computer and use it in GitHub Desktop.
error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
--> src/lib.rs:216:24
|
216 | AlpnConnecting(Box::pin(fut))
| ^^^^^^^^^^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
|
= help: within `core::fmt::Void`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)`
= note: required because it appears within the type `std::marker::PhantomData<*mut (dyn std::ops::Fn() + 'static)>`
= note: required because it appears within the type `core::fmt::Void`
= note: required because of the requirements on the impl of `std::marker::Send` for `&core::fmt::Void`
= note: required because it appears within the type `std::fmt::ArgumentV1<'_>`
= note: required because it appears within the type `[std::fmt::ArgumentV1<'_>; 1]`
= 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, 't19, 't20, 't21, 't22, 't23, 't24> {hyper::client::connect::Destination, u16, trust_dns_resolver::async_resolver::AsyncResolver, impl futures::future::Future, &'r trust_dns_resolver::async_resolver::AsyncResolver, for<'t25> fn(std::fmt::Arguments<'t25>) -> std::string::String {std::fmt::format}, fn(&'s [&'s str], &'s [std::fmt::ArgumentV1<'s>]) -> std::fmt::Arguments<'s> {std::fmt::Arguments::<'s>::new_v1}, &'t0 str, str, &'t1 str, [&'t2 str; 2], &'t3 [&'t4 str; 2], &'t5 [&'t6 str; 2], &'t7 [&'t8 str], &'t9 hyper::client::connect::Destination, &'t10 str, &'t11 &'t12 str, (&'t13 &'t14 str,), [std::fmt::ArgumentV1<'t15>; 1], &'t16 [std::fmt::ArgumentV1<'t17>; 1], &'t18 [std::fmt::ArgumentV1<'t19>; 1], &'t20 [std::fmt::ArgumentV1<'t21>], std::fmt::Arguments<'t22>, std::string::String, &'t23 std::string::String, &'t24 str, trust_dns_resolver::async_resolver::Background<trust_dns_resolver::lookup_ip::LookupIpFuture>, futures_util::compat::compat01as03::Compat01As03<trust_dns_resolver::async_resolver::Background<trust_dns_resolver::lookup_ip::LookupIpFuture>>, ()}`
= note: required because it appears within the type `[static generator@src/lib.rs:133:76: 168:6 dst:hyper::client::connect::Destination for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24> {hyper::client::connect::Destination, u16, trust_dns_resolver::async_resolver::AsyncResolver, impl futures::future::Future, &'r trust_dns_resolver::async_resolver::AsyncResolver, for<'t25> fn(std::fmt::Arguments<'t25>) -> std::string::String {std::fmt::format}, fn(&'s [&'s str], &'s [std::fmt::ArgumentV1<'s>]) -> std::fmt::Arguments<'s> {std::fmt::Arguments::<'s>::new_v1}, &'t0 str, str, &'t1 str, [&'t2 str; 2], &'t3 [&'t4 str; 2], &'t5 [&'t6 str; 2], &'t7 [&'t8 str], &'t9 hyper::client::connect::Destination, &'t10 str, &'t11 &'t12 str, (&'t13 &'t14 str,), [std::fmt::ArgumentV1<'t15>; 1], &'t16 [std::fmt::ArgumentV1<'t17>; 1], &'t18 [std::fmt::ArgumentV1<'t19>; 1], &'t20 [std::fmt::ArgumentV1<'t21>], std::fmt::Arguments<'t22>, std::string::String, &'t23 std::string::String, &'t24 str, trust_dns_resolver::async_resolver::Background<trust_dns_resolver::lookup_ip::LookupIpFuture>, futures_util::compat::compat01as03::Compat01As03<trust_dns_resolver::async_resolver::Background<trust_dns_resolver::lookup_ip::LookupIpFuture>>, ()}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/lib.rs:133:76: 168:6 dst:hyper::client::connect::Destination for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24> {hyper::client::connect::Destination, u16, trust_dns_resolver::async_resolver::AsyncResolver, impl futures::future::Future, &'r trust_dns_resolver::async_resolver::AsyncResolver, for<'t25> fn(std::fmt::Arguments<'t25>) -> std::string::String {std::fmt::format}, fn(&'s [&'s str], &'s [std::fmt::ArgumentV1<'s>]) -> std::fmt::Arguments<'s> {std::fmt::Arguments::<'s>::new_v1}, &'t0 str, str, &'t1 str, [&'t2 str; 2], &'t3 [&'t4 str; 2], &'t5 [&'t6 str; 2], &'t7 [&'t8 str], &'t9 hyper::client::connect::Destination, &'t10 str, &'t11 &'t12 str, (&'t13 &'t14 str,), [std::fmt::ArgumentV1<'t15>; 1], &'t16 [std::fmt::ArgumentV1<'t17>; 1], &'t18 [std::fmt::ArgumentV1<'t19>; 1], &'t20 [std::fmt::ArgumentV1<'t21>], std::fmt::Arguments<'t22>, std::string::String, &'t23 std::string::String, &'t24 str, trust_dns_resolver::async_resolver::Background<trust_dns_resolver::lookup_ip::LookupIpFuture>, futures_util::compat::compat01as03::Compat01As03<trust_dns_resolver::async_resolver::Background<trust_dns_resolver::lookup_ip::LookupIpFuture>>, ()}]>`
= 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> {fn(std::result::Result<std::net::SocketAddr, std::io::Error>) -> std::result::Result<<std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::Ok, <std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::Error> {<std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::into_result}, fn(hyper::client::connect::Destination) -> impl core::future::future::Future {AlpnConnector::resolve}, hyper::client::connect::Destination, impl core::future::future::Future, (), std::net::SocketAddr, fn(std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error>) -> std::result::Result<<std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::Ok, <std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::Error> {<std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::into_result}, fn(&'r std::net::SocketAddr) -> impl core::future::future::Future {tokio_net::tcp::stream::TcpStream::connect::<&'r std::net::SocketAddr>}, &'s std::net::SocketAddr, impl core::future::future::Future, impl core::future::future::Future, tokio_net::tcp::stream::TcpStream, tokio_rustls::TlsConnector, &'t2 tokio_rustls::TlsConnector, webpki::name::DNSName, &'t3 webpki::name::DNSName, webpki::name::DNSNameRef<'t4>, tokio_rustls::Connect<tokio_net::tcp::stream::TcpStream>}`
= note: required because it appears within the type `[static generator@src/lib.rs:199:30: 214:10 dst:hyper::client::connect::Destination, config:std::sync::Arc<rustls::client::ClientConfig>, host:webpki::name::DNSName for<'r, 's, 't0, 't1, 't2, 't3, 't4> {fn(std::result::Result<std::net::SocketAddr, std::io::Error>) -> std::result::Result<<std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::Ok, <std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::Error> {<std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::into_result}, fn(hyper::client::connect::Destination) -> impl core::future::future::Future {AlpnConnector::resolve}, hyper::client::connect::Destination, impl core::future::future::Future, (), std::net::SocketAddr, fn(std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error>) -> std::result::Result<<std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::Ok, <std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::Error> {<std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::into_result}, fn(&'r std::net::SocketAddr) -> impl core::future::future::Future {tokio_net::tcp::stream::TcpStream::connect::<&'r std::net::SocketAddr>}, &'s std::net::SocketAddr, impl core::future::future::Future, impl core::future::future::Future, tokio_net::tcp::stream::TcpStream, tokio_rustls::TlsConnector, &'t2 tokio_rustls::TlsConnector, webpki::name::DNSName, &'t3 webpki::name::DNSName, webpki::name::DNSNameRef<'t4>, tokio_rustls::Connect<tokio_net::tcp::stream::TcpStream>}]`
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/lib.rs:199:30: 214:10 dst:hyper::client::connect::Destination, config:std::sync::Arc<rustls::client::ClientConfig>, host:webpki::name::DNSName for<'r, 's, 't0, 't1, 't2, 't3, 't4> {fn(std::result::Result<std::net::SocketAddr, std::io::Error>) -> std::result::Result<<std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::Ok, <std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::Error> {<std::result::Result<std::net::SocketAddr, std::io::Error> as std::ops::Try>::into_result}, fn(hyper::client::connect::Destination) -> impl core::future::future::Future {AlpnConnector::resolve}, hyper::client::connect::Destination, impl core::future::future::Future, (), std::net::SocketAddr, fn(std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error>) -> std::result::Result<<std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::Ok, <std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::Error> {<std::result::Result<tokio_net::tcp::stream::TcpStream, std::io::Error> as std::ops::Try>::into_result}, fn(&'r std::net::SocketAddr) -> impl core::future::future::Future {tokio_net::tcp::stream::TcpStream::connect::<&'r std::net::SocketAddr>}, &'s std::net::SocketAddr, impl core::future::future::Future, impl core::future::future::Future, tokio_net::tcp::stream::TcpStream, tokio_rustls::TlsConnector, &'t2 tokio_rustls::TlsConnector, webpki::name::DNSName, &'t3 webpki::name::DNSName, webpki::name::DNSNameRef<'t4>, tokio_rustls::Connect<tokio_net::tcp::stream::TcpStream>}]>`
= note: required because it appears within the type `impl core::future::future::Future`
= note: required for the cast to the object type `dyn core::future::future::Future<Output = std::result::Result<(tokio_rustls::client::TlsStream<tokio_net::tcp::stream::TcpStream>, hyper::client::connect::Connected), std::io::Error>> + std::marker::Send`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment