Re: [PATCH] Rust: Implement a unique reference type URef supplementing ARef

Miguel Ojeda
2025-02-28T13:17:50Z

On Fri, Feb 28, 2025 at 12:11 PM Andreas Hindborg <a.hindborg@kernel.org> wrote:
>
> When the trait is unsafe, we need to specify the conditions under which
> it is safe to implement:
>
> # Safety
>
> - Requirement 1
> - Requirement 2
> - etc
>
> See `AlwaysRefCounted` for reference on formatting.

I think should be caught by Clippy -- Oliver, please try building with
`CLIPPY=1` (we would like Clippy-clean builds as much as reasonably
possible), you should be getting something like:

error: docs for unsafe trait missing `# Safety` section
--> rust/........rs:23:1
|
23 | pub unsafe trait A {}
| ^^^^^^^^^^^^^^^^^^
|
= help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
= note: `-D clippy::missing-safety-doc` implied by `-D warnings`
= help: to override `-D warnings` add
`#[allow(clippy::missing_safety_doc)]`

Thanks!

Cheers,
Miguel