Re: [RFC PATCH 1/5] doc: rust: create safety standard

From: Benno Lossin
Date: Wed Jul 24 2024 - 17:28:50 EST


On 24.07.24 23:20, Miguel Ojeda wrote:
> On Wed, Jul 24, 2024 at 10:32 PM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>>
>> There are also several clippy lints [1] that we could start using:
>> - missing_safety_doc
>> - multiple_unsafe_ops_per_block
>> - undocumented_unsafe_blocks
>> - unnecessary_safety_comment
>> - unnecessary_safety_doc
>>
>> I personally think we should enable all of them.
>
> We briefly talked about it today -- others agreed on going ahead with
> something like the diff I sent the other day, so I will send a formal
> patch -- it has been a while since we wanted to do this (long enough
> that we were the ones requesting one of those lints, and it got
> implemented since then... :)

Perfect :)

> And we can keep the `TODO`s as "good first issue"s (I already updated
> some days ago our good first issue about it:
> https://github.com/Rust-for-Linux/linux/issues/351).

That sounds like a good idea.

> We can also enable the others easily, most are essentially clean
> already anyway, so I will send that as well.

Sounds good.

> The only one that may be more "annoying" is
> `multiple_unsafe_ops_per_block`. On the other hand, it could in fact
> force people to think about every "bullet point" of the requirements
> (the lint highlights nicely the different operations).

Oh yeah, that might be annoying if we have

unsafe {
(*ptr).a = 0;
(*ptr).b = 0;
}

So it probably is better to leave that one disabled.

---
Cheers,
Benno