External Publication
Visit Post

Drop on `await` point

Rust Internals [Unofficial] March 30, 2026
Source

Ddystopia:

Mostly mutexes do rely on the fact that they are not held across await points, to prevent deadlocks.

i suppose this is semantics, but i find "rely on" to be innacurate, as MutexGuard and RefCell::Ref do nothing to prevent being held across an awaitpoint, and work perfectly fine when being held across one (as long as one doesn't deadlock them).

but it is true there are lints against doing so and they are good lints, because await points do strongly increase the chance of deadlocks.

i really liked this on the subject of mutexes and await points, though it is technically more about cancel safety.

cliffle.com

Mutex without lock, Queue without push: cancel safety in lilos

i do agree with your goal, but i personally feel it should be more of a warning, like must_use

Discussion in the ATmosphere

Loading comments...