Re: [PATCH] rust_binder: add ownership assertion to Node::add_death

From: Miguel Ojeda

Date: Wed Jun 10 2026 - 02:13:59 EST


On Wed, Jun 10, 2026 at 7:45 AM Onur Özkan <work@xxxxxxxxxxxxx> wrote:
>
> I think having a `debug_assert!` should be fine. That's also your suggestion in
> the GH issue link above.

Yeah, there seems to be confusion about the asserts.

If there were a soundness issue, then an `assert!` may "fix" it, but
it would usually the wrong way to do so, and a `debug_assert!`
wouldn't be a fix it at all.

And for other cases, `assert!` is typically too strong for Linux
(outside const context, tests, special `cfg`s, etc.).

In addition, please consider whether a `pr_warn(_once)!` or similar
may be a good idea to pair with the `debug_assert!`.

Cheers,
Miguel