← Rule catalog

Source kernel · Correctness

block_in_place on a current-thread runtime

rust_doctor::source::block_in_place_on_current_thread

Run the test or the runtime with flavor = "multi_thread", or move the blocking work into tokio::task::spawn_blocking; tokio documents that block_in_place panics on a current-thread runtime.

Category
Correctness
Default level
warn
Tier
P1
Producer
Source kernel
Diff scope
item

Not a defect when

The call is only reached under a runtime the function itself never runs on, for example a helper invoked solely from a multi-thread runtime it builds.

Crates it waits for

It runs only where at least one of these crates is resolved, and every one resolved sits in the range it was validated on:

  • tokio >=1, <2

What it reads

Source text, without resolving types or expanding macros.

Tier

Serious: worth interrupting other work for.

The tier bounds how severe a rule may be; its category bounds the tier.

Diff scope

The function or item around the changed line.

What --scope contextual looks at to decide whether a change caused the finding.

Change it

Turn it off, or make it blocking, without touching the code it flags:

rust-doctor --rule rust_doctor::source::block_in_place_on_current_thread=off .
rust-doctor --rule rust_doctor::source::block_in_place_on_current_thread=error .

Set it once in rust-doctor.toml

Other Correctness rules