You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: compiles, the futurue should be Send, as the pointer is dropped before the call to await
Instead, this happened:
error: future cannot be sent between threads safely
--> src/main.rs:18:22
|
18 | tokio::spawn(async move {
| ______________________^
19 | | handshake(&mut socket).await;
20 | | process(socket).await;
21 | | });
| |_________^ future created by async block is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const IpHeader`
note: future is not `Send` as this value is used across an await
--> src/packet_stream.rs:53:84
|
42 | let ipptr = packet.as_ptr() as *const IpHeader;
| ----- has type `*const IpHeader` which is not `Send`
...
53 | if AsyncReadExt::take(&mut self.tcp, tot_len - 20).read_to_end(&mut packet).await? < (tot_len - 20) as usize {
| ^^^^^^ await occurs here, with `ipptr` maybe used later
...
62 | }
| - `ipptr` is later dropped here
note: required by a bound in `tokio::spawn`
--> /home/akos/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/task/spawn.rs:127:21
|
127 | T: Future + Send + 'static,
| ^^^^ required by this bound in `tokio::spawn`
I tried this code:
I expected to see this happen: compiles, the futurue should be
Send
, as the pointer is dropped before the call to awaitInstead, this happened:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: