Skip to content

Conversation

@ErwanDL
Copy link

@ErwanDL ErwanDL commented Jun 17, 2021

While working on routerify/routerify-websocket#3, I encountered issues when trying to build the test_stream_body.rs example, after having updated routerify-websocket to use tokio 1.x.

error[E0425]: cannot find function `spawn` in crate `tokio`
   --> ~/.cargo/git/checkouts/stream-body-094892f572609189/4ca8d42/src/body.rs:104:16
    |
104 |         tokio::spawn(async move {
    |                ^^^^^ not found in `tokio`
    |
help: consider importing one of these items
    |
1   | use crate::body::io::async_write::io::sys::ext::net::raw_fd::sys_common::util::thread::spawn;
    |
1   | use std::thread::spawn;
    |

error[E0425]: cannot find function `copy` in module `io`
   --> ~/.cargo/git/checkouts/stream-body-094892f572609189/4ca8d42/src/body.rs:105:35
    |
105 |             if let Err(err) = io::copy(&mut r, &mut w).await {
    |                                   ^^^^ not found in `io`
    |
help: consider importing one of these items
    |
1   | use core::ptr::copy;
    |
1   | use crate::body::io::async_write::io::copy;
    |
1   | use crate::body::io::async_write::io::sys::ext::net::raw_fd::sys_common::fs::copy;
    |
1   | use crate::body::io::async_write::io::sys::ext::process::process::fs::copy;
    |
      and 5 other candidates

I am not 100% sure why the error did not arise while routerify-websocket was still using tokio 0.2 (probably due to some cargo dependency resolution shenanigans), but it seems to me that stream-body's Cargo.toml should list the features that are used: "rt-core" is required by tokio::spawn and "io-util" is required by tokio::io::copy, both used in body.rs.

Having this PR merged will allow me to continue working on updating routerify-websocket. I may need to follow up with another PR on stream-body (updating to tokio 1.x and hyper 0.14) before being able to push the routerify-websocket update.

"rt-core" is required by `tokio::spawn`, "io-util" is required by `tokio::io::copy`
@ErwanDL ErwanDL changed the title Add apprpriate tokio features to Cargo.toml Add appropriate tokio features to Cargo.toml Jun 17, 2021
@gsserge
Copy link
Member

gsserge commented Jul 6, 2021

Apologies for the delayed response. I will try to look into the PR soon.

@gsserge
Copy link
Member

gsserge commented Jul 14, 2021

@ErwanDL maybe we should update to tokio 1 right away?

@ErwanDL
Copy link
Author

ErwanDL commented Jul 15, 2021

@gsserge I agree, that PR was just really a temporary fix while I was working on updating to tokio v1. However, I have tried to do the update to tokio v1 on this branch, but I am somewhat stuck at the moment as async-pipe's API has changed, due to tokio's AsyncRead's API changing in v1 (prepare_uninitialized_buffer has disappeared). Given that I'm not too familiar with stream-body's code, I'm having a hard time figuring out the correct fix to accomodate these changes 😕

@threeseed
Copy link

threeseed commented Jul 24, 2021

@ErwanDL @gsserge

Have pushed a new PR here: #3

Currently using my fork of async-pipe-rs until routerify/async-pipe-rs#10 is merged.

@ErwanDL ErwanDL closed this Aug 24, 2021
@rousan
Copy link
Member

rousan commented Jan 3, 2022

@ErwanDL, @gsserge , I removed the stream-body dependency from routerify-websocket in version 3, as the stream-body uses async-pipe-rs which uses unsafe code, so, for safety and security reasons, we will not use async-pipe-rs and stream-body in Routerify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants