[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCWO3V7WQP0G.127BYBORGE85H@kernel.org>
Date: Fri, 19 Sep 2025 11:26:19 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Joel Fernandes" <joelagnelf@...dia.com>, "Danilo Krummrich"
<dakr@...nel.org>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, "Maarten Lankhorst"
<maarten.lankhorst@...ux.intel.com>, "Maxime Ripard" <mripard@...nel.org>,
"Thomas Zimmermann" <tzimmermann@...e.de>, "David Airlie"
<airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, "Miguel Ojeda" <ojeda@...nel.org>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Trevor Gross" <tmgross@...ch.edu>,
"Bjorn Helgaas" <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kwilczynski@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Subject: Re: [PATCH] rust: io: use const generics for read/write offsets
On Fri Sep 19, 2025 at 9:59 AM CEST, Joel Fernandes wrote:
> Hello, Danilo,
>
>> On Sep 19, 2025, at 1:26 AM, Danilo Krummrich <dakr@...nel.org> wrote:
>>
>> On Thu Sep 18, 2025 at 8:13 PM CEST, Joel Fernandes wrote:
>>>> On Thu, Sep 18, 2025 at 03:02:11PM +0000, Alice Ryhl wrote:
>>>> Using build_assert! to assert that offsets are in bounds is really
>>>> fragile and likely to result in spurious and hard-to-debug build
>>>> failures. Therefore, build_assert! should be avoided for this case.
>>>> Thus, update the code to perform the check in const evaluation instead.
>>>
>>> I really don't think this patch is a good idea (and nobody I spoke to thinks
>>> so). Not only does it mess up the user's caller syntax completely, it is also
>>
>> I appreacite you raising the concern,
>> but I rather have other people speak up
>> themselves.
>
> I did not mean to speak for others, sorry it came across like that
> (and that is certainly not what I normally do). But I discussed the
> patch in person since we are at a conference and discussing it in
> person, and I did not get a lot of consensus on this. That is what I
> was trying to say. If it was a brilliant or great idea, I would have
> hoped for at least one person to tell me that this is exactly how we
> should do it.
I'm also not really thrilled to see lots more turbofish syntax. However,
if we can avoid the nasty build_assert errors then in my opinion it's
better. (yes we do have Gary's cool klint tool to handle them correctly,
but not every user will be aware of that tool).
Maybe we should ask Rust about adding `const` arguments in their normal
position again :)
---
Cheers,
Benno
Powered by blists - more mailing lists