Skip to content

Clarify the behavior of several spawn_local methods #7561

@ADD-SP

Description

@ADD-SP

This issue is tracked by #7558, and it MUST be done before stabilizing the LocalRuntime.

What are the spawn_local methods?

tokio::task::spawn_local is used for spawn a !Send Future on the LocalSet or LocalRuntime, and there are several methods call tokio::task::spawn_local internally.

What should we do?

We need to update the docs to clarify the behavior when the methods above are called on the LocalRuntime.

What is the behavior on the LocalRuntime?

Invoking these methods on the LocalRuntime doesn't panic.

What else do we need to do?

It would be better specifically reminding the authors of library crates to use these methods with caution, as calling them in their libraries may lead to their downstream panics, especially if their downstream uses a multi-threaded runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokioArea: The main tokio crateA-tokio-utilArea: The tokio-util crateE-easyCall for participation: Experience needed to fix: Easy / not muchM-taskModule: tokio/taskT-docsTopic: documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions