All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Daniel Almeida" <daniel.almeida@collabora.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v6] rust: kernel: add support for bits/genmask macros
Date: Tue, 17 Jun 2025 00:02:50 +0900	[thread overview]
Message-ID: <DAO1RRSIUW6F.2FUMJ00GSXUIQ@nvidia.com> (raw)
In-Reply-To: <3EAB4EAE-DDCF-47C4-A712-77B37AEDF4E8@collabora.com>

On Mon Jun 16, 2025 at 11:56 PM JST, Daniel Almeida wrote:
> Hi Alex,
>
>> On 16 Jun 2025, at 11:52, Alexandre Courbot <acourbot@nvidia.com> wrote:
>> 
>> On Mon Jun 16, 2025 at 11:45 PM JST, Daniel Almeida wrote:
>>> 
>>> 
>>>> On 16 Jun 2025, at 11:42, Daniel Almeida <daniel.almeida@collabora.com> wrote:
>>>> 
>>>> Hi Boqun,
>>>> 
>>>>> 
>>>>> We should tell/educate people to do the right thing, if a..b is not
>>>>> inclusive in Rust, then we should treat them as non-inclusive in Rust
>>>>> kernel code. Otherwise you create confusion for no reason. My assumption
>>>>> is that most people will ask "what's the right way to do this" first
>>>>> instead of replicating the old way.
>>>>> 
>>>>> Regards,
>>>>> Boqun
>>>>> 
>>>> 
>>>> This is just my opinion, of course:
>>>> 
>>>> I _hardly_ believe this will be the case. When people see genmask and two
>>>> numbers, they expect the range to be inclusive, full stop (at least IMHO). That's how it has
>>>> worked for decades, so it’s only natural to expect this behavior to transfer over.
>>>> 
>>>> However, I do understand and agree with your point, and I will change the
>>>> implementation here to comply. Perhaps we can use some markdown to alert users?
>>>> 
>>>> — Daniel
>>> 
>>> Or better yet, perhaps we should only support a..=b.
>> 
>> ... or just drop the ranges and do as Daniel initially did, using two
>> arguments. But I agree with Boqun that we should not deviate from the
>> official interpretation of ranges if we use them - the fact that `Range`
>> is exclusive on its upper bound is documented and a property of the type
>> itself.
>
> By the same token, I agree that we should use ranges instead of two arguments,
> if said two arguments represent a range anyways. So my vote is for a..=b JFYI.

That works for me, it has the benefit of being absolutely clear that the
range is inclusive.

  reply	other threads:[~2025-06-16 15:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 14:14 [PATCH v6] rust: kernel: add support for bits/genmask macros Daniel Almeida
2025-06-10 18:08 ` Miguel Ojeda
2025-06-10 20:52   ` Daniel Almeida
2025-06-14 13:38 ` Alexandre Courbot
2025-06-14 15:06   ` Boqun Feng
2025-06-14 15:56     ` Boqun Feng
2025-06-14 16:05       ` Boqun Feng
2025-06-18 20:58         ` Joel Fernandes
2025-06-20 13:48           ` Daniel Almeida
2025-06-20 20:47             ` Joel Fernandes
2025-06-15 12:59     ` Alexandre Courbot
2025-06-16 14:14   ` Daniel Almeida
2025-06-16 14:29     ` Boqun Feng
2025-06-16 14:42       ` Daniel Almeida
2025-06-16 14:45         ` Daniel Almeida
2025-06-16 14:52           ` Alexandre Courbot
2025-06-16 14:56             ` Daniel Almeida
2025-06-16 15:02               ` Alexandre Courbot [this message]
2025-06-16 15:02           ` Boqun Feng
2025-06-16 15:08     ` Alexandre Courbot

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=DAO1RRSIUW6F.2FUMJ00GSXUIQ@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.