rust-lang / rust-lang/rust-clippy

Find "dangerous" blocking constructs in async contexts (`.wait()`, `block_on`, etc.)

Open
#4,427 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint T-async-await
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

This is related to https://github.com/rust-lang/rust-clippy/issues/4377, which proposed warning about blocking operations like println! inside an async context. That is definitely a promising idea, but it's also very ambitious, because almost anything could block.

But there's also a specific set of blocking constructs that can potentially deadlock the entire tokio (or other) runtime. These include things like calling block_on or .wait inside an async context. There are easy to include by mistake when converting non-async code to async. And there are fewer of these dangerous calls, which would make them easier to lint for.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the related Clippy issue #4377 and the examples of dangerous blocking calls described here, including block_on and .wait() in async contexts. Determine the supported construct set and the expected lint behavior before identifying the relevant Clippy implementation and test locations. Done means the agreed dangerous constructs are detected without treating general blocking operations as in scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.