Cannot call task::block_on inside task::spawn
Open
- Dominant language
- Rust
- Stars
- 4.1k
- Forks
- 339
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.