-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Labels
bugSomething isn't workingSomething isn't working
Description
It turns out that Arguments
is non-Send
, which means passing it to a spawned Future may not work because the future itself is Send
.
use async_std::task;
use async_std::prelude::*;
use async_std::io;
fn main() {
task::block_on(async {
task::spawn(async {
// This doesn't compile
io::stderr().write_fmt(format_args!("hello")).await?;
}).await
})
}
This is causing some bugs. Posting this for future reference.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ghost commentedon Oct 14, 2019
As a temporary hack, we could write first to a
String
and the write thatString
into the writer.yoshuawuyts commentedon Oct 15, 2019
Oh lol, I like that. Sounds good!
yoshuawuyts commentedon Oct 15, 2019
Going to mark this as "good first issue" so someone can pick this up!
Michael-J-Ward commentedon Oct 15, 2019
Isn't that what it's already doing?
async-std/src/io/write/mod.rs
Lines 239 to 246 in 00d9364
Michael-J-Ward commentedon Oct 15, 2019
Or do you mean to change the signature of
write_fmt
so it takes aString
instead of anArguments
like this, which I have working:yoshuawuyts commentedon Oct 15, 2019
@Michael-J-Ward dang, you're right. Okay this may not be as straight forward as we'd like :/