From: "Benno Lossin" <lossin@kernel.org>
To: "Marcelo Moreira" <marcelomoreira1905@gmail.com>,
"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Cc: <dakr@kernel.org>, <ojeda@kernel.org>,
<rust-for-linux@vger.kernel.org>, <skhan@linuxfoundation.org>,
<linux-kernel-mentees@lists.linuxfoundation.org>,
<~lkcamp/patches@lists.sr.ht>
Subject: Re: [PATCH v4 1/3] rust: revocable: update write invariant and fix safety comments
Date: Mon, 16 Jun 2025 09:15:36 +0200 [thread overview]
Message-ID: <DANRU0TC3F11.30DUO1LQZUE42@kernel.org> (raw)
In-Reply-To: <CAPZ3m_gGOy2XsiVaVbbAivwO0JBpgqMke68LV4OD+i2L1Z5PEw@mail.gmail.com>
On Mon Jun 16, 2025 at 2:36 AM CEST, Marcelo Moreira wrote:
> Em dom., 15 de jun. de 2025 às 05:38, Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> escreveu:
>>
>> On Sun, Jun 15, 2025 at 1:12 AM Marcelo Moreira
>> <marcelomoreira1905@gmail.com> wrote:
>> >
>> > what about:
>> >
>> > // SAFETY: `self.data` is valid for writes because of `Self`'s type invariants.
>> > // The `&mut Self` context guarantees exclusive access, meaning no other
>> > // thread can concurrently access `data`.
>> > //
>> > // - `drop_in_place` is valid to call because `drop` is only called once.
>> > unsafe { drop_in_place(p.data.get()) };
>> >
>> > I'm not sure if the line break in the comment is okay...
>>
>> Benno likely meant to use bullet points for each one, rather than a
>> bullet point after a paragraph.
>>
>> If you do e.g.
>>
>> git grep -A5 '// SAFETY:$' -- rust/kernel
>>
>> you will find examples of that.
>
> Cool! Thanks for the command Miguel =D it helped a lot.
>
> I'm ready to send like this:
>
> // SAFETY:
> // - `self.data` is valid for writes because of `Self`'s type invariants.
> // - The `&mut Self` context guarantees exclusive access, meaning no other
> // thread can concurrently access `data`.
^ spurious space here,
This argument is actually an extension of the previous one.
> // - `drop_in_place` is valid to call because `drop` is only called once.
This phrasing feels a bit weird to me, but I can't put my finger on what
exactly...
> unsafe { drop_in_place(p.data.get()) };
How about:
// - `self.data` is valid for writes because of `Self`'s type invariants:
// `&mut Self` guarantees exclusive access, thus no other thread can concurrently access `data`.
// - this function is a drop function, thus this code is at most executed once.
---
Cheers,
Benno
next prev parent reply other threads:[~2025-06-16 7:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 23:26 [PATCH v4 0/3] rust: revocable: documentation and refactorings Marcelo Moreira
2025-06-02 23:26 ` [PATCH v4 1/3] rust: revocable: update write invariant and fix safety comments Marcelo Moreira
2025-06-12 9:02 ` Benno Lossin
2025-06-12 19:22 ` Marcelo Moreira
2025-06-14 18:05 ` Benno Lossin
2025-06-14 23:11 ` Marcelo Moreira
2025-06-15 8:38 ` Miguel Ojeda
2025-06-16 0:36 ` Marcelo Moreira
2025-06-16 7:15 ` Benno Lossin [this message]
2025-06-17 2:49 ` Marcelo Moreira
2025-06-17 7:18 ` Benno Lossin
2025-06-26 16:59 ` Marcelo Moreira
2025-06-13 14:08 ` Danilo Krummrich
2025-06-02 23:26 ` [PATCH v4 2/3] rust: revocable: simplify RevocableGuard for internal safety Marcelo Moreira
2025-06-12 9:04 ` Benno Lossin
2025-06-12 9:28 ` Alice Ryhl
2025-06-12 9:52 ` Benno Lossin
2025-06-12 18:52 ` Marcelo Moreira
2025-06-14 18:04 ` Benno Lossin
2025-06-13 14:11 ` Danilo Krummrich
2025-06-14 17:00 ` Benno Lossin
2025-06-02 23:26 ` [PATCH v4 3/3] rust: revocable: split revoke_internal into revoke and revoke_nosync Marcelo Moreira
2025-06-12 9:06 ` Benno Lossin
2025-06-12 19:29 ` Marcelo Moreira
2025-06-13 14:09 ` Danilo Krummrich
2025-06-16 10:26 ` [PATCH v4 0/3] rust: revocable: documentation and refactorings Danilo Krummrich
2025-06-16 19:33 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DANRU0TC3F11.30DUO1LQZUE42@kernel.org \
--to=lossin@kernel.org \
--cc=dakr@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=marcelomoreira1905@gmail.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=~lkcamp/patches@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox