Skip to content

write_fmt fails inside spawned task #329

Open
@yoshuawuyts

Description

@yoshuawuyts

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
    })
}

2019-10-14-185507_1920x1080

This is causing some bugs. Posting this for future reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions