Describe the bug
When building rust from source getting errors:
Some errors have detailed explanations: E0562, E0706.
For more information about an error, try rustc --explain E0562.
error: could not compile wstunnel (bin "wstunnel") due to 34 previous errors
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
error[E0562]: impl Trait only allowed in function and inherent method return types, not in trait method return types
--> src/tunnel/transport/mod.rs:21:28
error[E0562]: impl Trait only allowed in function and inherent method return types, not in trait method return types
--> src/tunnel/transport/mod.rs:22:27
error[E0562]: impl Trait only allowed in function and inherent method return types, not in trait method return types
--> src/tunnel/transport/mod.rs:23:28
error[E0562]: impl Trait only allowed in function and inherent method return types, not in trait method return types
--> src/tunnel/transport/mod.rs:30:10
note: opaque type is declared here
--> src/tunnel/transport/io.rs:17:6
17
) -> anyhow::Result<()> {
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/client.rs:18:10
18
async fn connect_to_server<R, W>(
^^^^^^^^^^^^^^^^^
note: required because it appears within the type ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12
note: required because it appears within the type Instrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16
266
pub struct Instrumented {
^^^^^^^^^^^^
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/tunnel/client.rs:83:22
83
tokio::spawn(tunnel);
^^^^^^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:23:6
23
) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/client.rs:59:14
note: future is not Send as it awaits another future which is not Send
--> src/tunnel/client.rs:77:21
77
let _ = connect_to_server(request_id, &client_config, &remote_addr, cnx_stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type impl futures_util::Future<Output = Result<(), anyhow::Error>>, which is not Send
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> src/tunnel/client.rs:156:17
155
... tokio::spawn(
------------ required by a bound introduced by this call
156
note: opaque type is declared here
--> src/tunnel/transport/io.rs:17:6
17
) -> anyhow::Result<()> {
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/client.rs:89:14
89
pub async fn run_reverse_tunnel<F, Fut, T>(
^^^^^^^^^^^^^^^^^^
note: required because it appears within the type ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12
note: required because it appears within the type Instrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16
266
pub struct Instrumented {
^^^^^^^^^^^^
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> src/tunnel/server.rs:415:17
414
... tokio::task::spawn(
------------------ required by a bound introduced by this call
415
note: opaque type is declared here
--> src/tunnel/transport/io.rs:80:6
80
) -> anyhow::Result<()> {
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/server.rs:338:10
338
async fn ws_server_upgrade(
^^^^^^^^^^^^^^^^^
note: required because it appears within the type ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12
note: required because it appears within the type Instrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16
266
pub struct Instrumented {
^^^^^^^^^^^^
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> src/tunnel/server.rs:509:17
508
... tokio::task::spawn(
------------------ required by a bound introduced by this call
509
note: opaque type is declared here
--> src/tunnel/transport/io.rs:80:6
80
) -> anyhow::Result<()> {
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/server.rs:447:10
447
async fn http_server_upgrade(
^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12
note: required because it appears within the type Instrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16
266
pub struct Instrumented {
^^^^^^^^^^^^
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> src/tunnel/server.rs:656:85
656
... let con_fut = conn_builder.serve_connection(tls_stream, service_fn(http_upgrade_fn));
---------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^
required by a bound introduced by this call
note: opaque type is declared here
--> src/tunnel/server.rs:451:6
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/server.rs:557:14
note: required by a bound in hyper::server::conn::http2::Builder::<E>::serve_connection
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/server/conn/http2.rs:265:12
|
258 | pub fn serve_connection<S, I, Bd>(&self, io: I, service: S) -> Connection<I, S, E>
| ---------------- required by a bound in this associated function
...
265 | E: Http2ServerConnExec<S::Future, Bd>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in Builder::<E>::serve_connection
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> src/tunnel/server.rs:657:53
657
... if let Err(e) = con_fut.await {
^^^^^
note: opaque type is declared here
--> src/tunnel/server.rs:451:6
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/tunnel/server.rs:557:14
note: required because it appears within the type Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/map.rs:15:14
15
pub enum Map<Fut, F> {
^^^
note: required because it appears within the type Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/mod.rs:50:5
50
Map<Fut, F>(
^^^
note: required because it appears within the type H2StreamState<Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>, Either<String, BoxBody<Bytes, Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/proto/h2/server.rs:357:10
357
enum H2StreamState<F, B>
^^^^^^^^^^^^^
note: required because it appears within the type H2Stream<Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>, Either<String, BoxBody<Bytes, Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/proto/h2/server.rs:345:16
345
pub struct H2Stream<F, B>
^^^^^^^^
= note: required for `TokioExecutor` to implement `hyper::rt::Executor<hyper::proto::h2::server::H2Stream<futures_util::future::Map<impl futures_util::Future<Output = hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>>, fn(hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>) -> Result<hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>, anyhow::Error> {Result::<hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>, anyhow::Error>::Ok}>, http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>>`
= note: required for `TokioExecutor` to implement `Http2ServerConnExec<futures_util::future::Map<impl futures_util::Future<Output = hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>>, fn(hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>) -> Result<hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>, anyhow::Error> {Result::<hyper::Response<http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>, anyhow::Error>::Ok}>, http_body_util::Either<std::string::String, BoxBody<bytes::Bytes, anyhow::Error>>>`
= note: required for `Connection<TokioIo<TlsStream<TcpStream>>, ServiceFn<..., ...>, ...>` to implement `futures_util::Future`
= note: the full type name has been written to '/home/user/wstunnel/target/debug/deps/wstunnel-40bf6074578ce8e3.long-type-12316116632852263644.txt'
= note: required for `Connection<TokioIo<TlsStream<TcpStream>>, ServiceFn<..., ...>, ...>` to implement `std::future::IntoFuture`
= note: the full type name has been written to '/home/user/wstunnel/target/debug/deps/wstunnel-40bf6074578ce8e3.long-type-12316116632852263644.txt'
error: future cannot be sent between threads safely
--> src/main.rs:772:38
772
tokio::spawn(async move {
__^
773
let remote = tunnel.remote.clone();
774
let cfg = client_config.clone();
775
let connect_to_dest =
_
async {
...
796
}
797
});
_____^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:93:6
93
) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:793:108
-------------------------------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
797
... });
- tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:802:38
802
tokio::spawn(async move {
__^
803
let cfg = client_config.clone();
804
let (host, port) = to_host_port(tunnel.local);
805
let remote = RemoteAddr {
...
819
}
820
});
_____^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:93:6
93
) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:816:108
-------------------------------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
820
... });
- tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:827:38
827
tokio::spawn(async move {
__^
828
let cfg = client_config.clone();
829
let (host, port) = to_host_port(tunnel.local);
830
let remote = RemoteAddr {
...
864
}
865
});
_____^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:93:6
93
) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:861:108
-------------------------------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
865
... });
- tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:870:38
870
tokio::spawn(async move {
__^
871
let remote = tunnel.remote.clone();
872
let cfg = client_config.clone();
873
let connect_to_dest =
_
async {
...
894
}
895
});
_____^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:93:6
93
) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:891:108
-------------------------------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
895
... });
- tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:933:38
933
... tokio::spawn(async move {
____^
934
... if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
935
... error!("{:?}", err);
936
... }
937
... });
___^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...rc, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:934:97
934
if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_tunnel(client_config, server) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
937
});
- tunnel::client::run_tunnel(client_config, server) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:956:38
956
... tokio::spawn(async move {
____^
957
... if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
958
... error!("{:?}", err);
959
... }
960
... });
___^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...rc, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:957:97
957
if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_tunnel(client_config, server) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
960
});
- tunnel::client::run_tunnel(client_config, server) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:980:38
980
... tokio::spawn(async move {
____^
981
... if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
982
... error!("{:?}", err);
983
... }
984
... });
___^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...rc, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:981:97
981
if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_tunnel(client_config, server) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
984
});
- tunnel::client::run_tunnel(client_config, server) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:1012:38
1012
... tokio::spawn(async move {
____^
1013
... if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
1014
... error!("{:?}", err);
1015
... }
1016
... });
___^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...c, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:1013:97
1013
if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_tunnel(client_config, server) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
1016
});
- tunnel::client::run_tunnel(client_config, server) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:1038:38
1038
... tokio::spawn(async move {
____^
1039
... if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
1040
... error!("{:?}", err);
1041
... }
1042
... });
___^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...c, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:1039:97
1039
if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_tunnel(client_config, server) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
1042
});
- tunnel::client::run_tunnel(client_config, server) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:1057:38
1057
... tokio::spawn(async move {
____^
1058
... if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
1059
... error!("{:?}", err);
1060
... }
1061
... });
___^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...c, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:1058:97
1058
if let Err(err) = tunnel::client::run_tunnel(client_config, server).await {
------------------------------------------------- ^^^^^ await occurs here, with tunnel::client::run_tunnel(client_config, server) maybe used later
has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
...
1061
});
- tunnel::client::run_tunnel(client_config, server) is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
error: future cannot be sent between threads safely
--> src/main.rs:1068:38
1068
tokio::spawn(async move {
__^
1069
if let Err(err) = tunnel::client::run_tunnel(
1070
client_config,
1071
stream::once(async move {
...
1083
}
1084
});
_____^ future created by async block is not Send
note: opaque type is declared here
--> src/tunnel/client.rs:59:90
59
...c, incoming_cnx: T) -> anyhow::Result<()>
^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:651:10
651
async fn main() {
^^^^
note: future is not Send as this value is used across an await
--> src/main.rs:1080:30
1069
if let Err(err) = tunnel::client::run_tunnel(
___-
1070
client_config,
1071
stream::once(async move {
1072
let remote = RemoteAddr {
...
1078
}),
1079
)
_____- has type impl futures_util::Future<Output = Result<(), anyhow::Error>> which is not Send
1080
.await
^^^^^ await occurs here, with the value maybe used later
...
1084
});
- the value is later dropped here
note: required by a bound in tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21
164
pub fn spawn(future: F) -> JoinHandle
----- required by a bound in this function
165
where
166
F: Future + Send + 'static,
^^^^ required by this bound in spawn
Some errors have detailed explanations: E0562, E0706.
For more information about an error, try rustc --explain E0562.
error: could not compile wstunnel (bin "wstunnel") due to 34 previous errors
`
Describe the bug When building rust from source getting errors:
Some errors have detailed explanations: E0562, E0706. For more information about an error, try
rustc --explain E0562
. error: could not compilewstunnel
(bin "wstunnel") due to 34 previous errorsDo i miss any dependencies to build it?
Compilation in Windows = success without errors
cargo build #Debug 22mb cargo build --release # 7mb
To Reproduce sudo apt install curl git cargo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh git clone https://github.com/erebe/wstunnel.git cd wstunnel cargo build
Expected behavior Build completed successfully
Screenshots
Desktop (please complete the following information): Ubuntu 22.04.3 LTS rustc 1.73.0 (cc66ad468 2023-10-03) (built from a source tarball)
user@compiler:~/wstunnel$ cargo build Compiling wstunnel v9.2.2 (/home/user/wstunnel) error[E0706]: functions in traits cannot be declared
async` --> src/tunnel/transport/http2.rs:33:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/http2.rs:76:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/http2.rs:91:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/http2.rs:95:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/websocket.rs:42:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/websocket.rs:74:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/websocket.rs:86:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/websocket.rs:111:5async
because of thisimpl Trait
only allowed in function and inherent method return types, not in trait method return types --> src/tunnel/transport/mod.rs:21:28= note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more information
impl Trait
only allowed in function and inherent method return types, not in trait method return types --> src/tunnel/transport/mod.rs:22:27= note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more information
impl Trait
only allowed in function and inherent method return types, not in trait method return types --> src/tunnel/transport/mod.rs:23:28= note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more information
impl Trait
only allowed in function and inherent method return types, not in trait method return types --> src/tunnel/transport/mod.rs:30:10= note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more information
async
--> src/tunnel/transport/mod.rs:39:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/mod.rs:60:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/mod.rs:67:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationasync
--> src/tunnel/transport/mod.rs:74:5async
because of this= note:
async
trait functions are not currently supported = note: consider using theasync-trait
crate: https://crates.io/crates/async-trait = note: see issue #91611 https://github.com/rust-lang/rust/issues/91611 for more informationManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12 note: required because it appears within the typeInstrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as it awaits another future which is notSend
--> src/tunnel/client.rs:77:21impl futures_util::Future<Output = Result<(), anyhow::Error>>
, which is notSend
note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12 note: required because it appears within the typeInstrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12 note: required because it appears within the typeInstrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
ManuallyDrop<impl Future<Output = Result<(), Error>>>
--> /build/rustc-Nv44LE/rustc-1.73.0+dfsg0ubuntu1~bpo0/library/core/src/mem/manually_drop.rs:50:12 note: required because it appears within the typeInstrumented<impl Future<Output = Result<(), Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.40/src/instrument.rs:266:16tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/map.rs:15:14Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/mod.rs:50:5H2StreamState<Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>, Either<String, BoxBody<Bytes, Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/proto/h2/server.rs:357:10H2Stream<Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>, Either<String, BoxBody<Bytes, Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/proto/h2/server.rs:345:16note: required by a bound in
hyper::server::conn::http2::Builder::<E>::serve_connection
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/server/conn/http2.rs:265:12 | 258 | pub fn serve_connection<S, I, Bd>(&self, io: I, service: S) -> Connection<I, S, E> | ---------------- required by a bound in this associated function ... 265 | E: Http2ServerConnExec<S::Future, Bd>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound inBuilder::<E>::serve_connection
Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/map.rs:15:14Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/mod.rs:50:5H2StreamState<Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>, Either<String, BoxBody<Bytes, Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/proto/h2/server.rs:357:10H2Stream<Map<impl Future<Output = Response<Either<String, BoxBody<Bytes, Error>>>>, fn(Response<Either<String, BoxBody<Bytes, Error>>>) -> Result<Response<Either<String, BoxBody<Bytes, Error>>>, Error> {Result::<Response<Either<String, BoxBody<Bytes, Error>>>, Error>::Ok}>, Either<String, BoxBody<Bytes, Error>>>
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.1.0/src/proto/h2/server.rs:345:16Send
Send
as this value is used across an await --> src/main.rs:793:108tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:816:108tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:861:108tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:891:108tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_reverse_tunnel(client_config, remote, connect_to_dest)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:934:97tunnel::client::run_tunnel(client_config, server)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_tunnel(client_config, server)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:957:97tunnel::client::run_tunnel(client_config, server)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_tunnel(client_config, server)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:981:97tunnel::client::run_tunnel(client_config, server)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_tunnel(client_config, server)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:1013:97tunnel::client::run_tunnel(client_config, server)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_tunnel(client_config, server)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:1039:97tunnel::client::run_tunnel(client_config, server)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_tunnel(client_config, server)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:1058:97tunnel::client::run_tunnel(client_config, server)
maybe used laterimpl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
tunnel::client::run_tunnel(client_config, server)
is later dropped here note: required by a bound intokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Send
Send
as this value is used across an await --> src/main.rs:1080:30impl futures_util::Future<Output = Result<(), anyhow::Error>>
which is notSend
1080tokio::spawn
--> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.1/src/task/spawn.rs:166:21spawn
Some errors have detailed explanations: E0562, E0706. For more information about an error, try
rustc --explain E0562
. error: could not compilewstunnel
(bin "wstunnel") due to 34 previous errors `