rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@mailbox.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Philipp Stanner <phasta@kernel.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Tamir Duberstein" <tamird@gmail.com>,
	"Christian Schrefl" <chrisi.schrefl@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] rust: list: Add unsafe for container_of
Date: Tue, 18 Nov 2025 09:30:45 +0100	[thread overview]
Message-ID: <4db9dae5f659512146bd441cf2edf5a4aca16b93.camel@mailbox.org> (raw)
In-Reply-To: <CANiq72md+0Lerj+kqr6QiU6ySR3XjRzmuBiLjkpWWieM72wyeQ@mail.gmail.com>

On Tue, 2025-11-18 at 09:20 +0100, Miguel Ojeda wrote:
> On Tue, Nov 18, 2025 at 8:29 AM Philipp Stanner <phasta@kernel.org> wrote:
> > 
> > For unknown reasons, that problem was so far not visible and only gets
> > visible once one utilizes the list implementation from within the core
> > crate:
> 
> What do you mean by "unknown reasons"? The reason is known -- please
> refer to my message in the other thread. It should be mentioned in the
> log, including the link to the compiler issue.

OK.

> 
> Also, I assume you meant `kernel` crate, not `core`.
> 
> > Cc: stable@vger.kernel.org # v6.17+
> 
> No need to mention the kernel version if the Fixes tags implies it. In
> fact, it is more confusing, since it looks like there is a version
> where it should not be applied to.

It's absolutely common to provide it. If you feel better without it, I
can omit it, I guess.

> 
> > -                let container = $crate::container_of!(
> > +                let container = unsafe { $crate::container_of!(
> >                      links_field, $crate::list::ListLinksSelfPtr<Self, $num>, inner
> > -                );
> > +                ) };
> 
> Unsafe blocks require `// SAFETY: ...` comments.

Ah, right. Overlooked that because the other section already has one.

> 
> Also, please double-check if this is the formatting that `rustfmt` would use.

I ran rustfmt.


P.

  reply	other threads:[~2025-11-18  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18  7:28 [PATCH v2] rust: list: Add unsafe for container_of Philipp Stanner
2025-11-18  8:20 ` Miguel Ojeda
2025-11-18  8:30   ` Philipp Stanner [this message]
2025-11-18  9:00     ` Miguel Ojeda
2025-11-18  9:33       ` Philipp Stanner
2025-11-18 17:10         ` 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=4db9dae5f659512146bd441cf2edf5a4aca16b93.camel@mailbox.org \
    --to=phasta@mailbox.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=chrisi.schrefl@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=phasta@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tamird@gmail.com \
    --cc=tmgross@umich.edu \
    /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;
as well as URLs for NNTP newsgroup(s).