Skip to content

Recursive use of block_on panics #2090

Open
@That3Percent

Description

@That3Percent

When futures::executor::block_on is called recursively it panics with:

thread 'main' panicked at 'cannot execute `LocalPool` executor from within another executor: EnterError', src/libcore/result.rs:1188:5

Here is a complete program to reproduce this result:

fn main() {
    use futures::executor::block_on;
    block_on(async { block_on( async {} ) })
}

The documentation for block_on does not mention any limitation that would cause a panic, and it is unclear (to me at least) that such a limitation would be necessary.

The actual code that causes this panic is here in local_pool.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-executorArea: futures::executorS-blockedStatus: Blocked on something else

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions