RS.CLIPPY.AWAIT_HOLDING_INVALID_TYPE

Holding a type across an await point which is not allowed to be held as per the configuration

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: await_holding_invalid_type. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Allows users to configure types which should not be held across await suspension points.

Why is this bad?

There are some types which are perfectly safe to use concurrently from a memory access perspective, but that will cause bugs at runtime if they are held in such a way.

Example

await-holding-invalid-types = [
  # You can specify a type name
  "CustomLockType",
  # You can (optionally) specify a reason
  { path = "OtherCustomLockType", reason = "Relies on a thread local" }
]
struct CustomLockType;
struct OtherCustomLockType;
async fn foo() {
  let _x = CustomLockType;
  let _y = OtherCustomLockType;
  baz().await; // Lint violation
}

Configuration

  • await-holding-invalid-types: The list of types which may not be held across an await point.

    (default: [])