#6530·paradedb

Add a linter for `impl Drop`

Author: stuhoodCreated Sep 28, 2026Updated Sep 29, 2026
Labelsfeatureci/testspriority-high

What feature are you requesting?

We should add a linter to the codebase which requires that impl_safe_drop or an explicit override with a safety comment are used rather than directly implementing impl Drop.

impl Drop implementations which drop Postgres types should almost always use impl_safe_drop!: https://github.com/paradedb/paradedb/blob/62fd961ac81579964e56c2b4038f47ae77754db0/pg_search/src/postgres/utils.rs#L55-L86

Why are you requesting this feature?

When impl_safe_drop is not used dropping a type can cause an segfault during a transaction abort, or during an exit (see #6479).

It is very difficult to remember not to use impl Drop: we have failed to do it in many cases, and it is easily missed in review.

What is your proposed implementation for this feature?

No idea! We should investigate how to get a reliable lint in place in our code... ideally without forking any existing linters.

But the desired UX is that a bare impl Drop fails linting, and must be converted into either:

  1. impl_safe_drop!
  2. some other macro that promises not to destroy Postgres types OR marked with some sort of override comment

Full Name:

Stu Hood

Affiliation:

ParadeDB