Skip to content

Test timeouts #2798

Open
Open
@clarfonthey

Description

@clarfonthey

It would be really nice if Rust had some kind of built-in timeout functionality, e.g.:

panic_after(Duration::from_millis(100), || {
    do_a_thing()
}

The API could be something different, maybe, and maybe there'd be a way to integrate it with the thread API instead of the test API. But either way, it would be nice to have to import an external crate to have some sort of maximum runtime for tests, to avoid infinite loops destroying the test runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testProposals relating to testing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions