async-std icon indicating copy to clipboard operation
async-std copied to clipboard

Cannot call task::block_on inside task::spawn

Open orbli opened this issue 4 years ago • 0 comments

As title.

This is an issue opening from what we found in https://github.com/rmanoka/async-scoped/issues/2

Below is the code snippet that reproduce the problem, by the author of project there:

#[test]
fn test_recursive_block() {
    task::block_on(async {
        task::spawn(async {
            task::block_on(async {
                eprintln!("Hello block!");
            })
        });
    })
}

for myself, I would like to see if there is any suggestion of spawning a scoped task so i can reaccess the variable without giving up ownership.

orbli avatar Aug 16 '20 09:08 orbli