rust-lang / rust-lang/rust-clippy

lint `SyncSender::send`

Open
#766 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint E-medium L-correctness T-middle
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

I'm not sure many people are using the stdlib MPSC with select! destabilized, but I propose a lint that suggests SyncSender::send always be replaced with SyncSender::try_send.

The reason is that many users of SyncSender do not expect their senders to ever block, and are only using SyncSender to prevent bugs on the receiver end from translating into memory-DoS bugs. However, when using send this means that such bugs can translate into DoS anyway by deadlocking.

This should be allow by default.

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 examining the lint entry point for SyncSender::send and compare it with SyncSender::try_send. Determine how the suggestion should replace the call and confirm that the new lint is allowed by default; the work is done when the lint emits that suggestion for the intended usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.