From: Filipe Xavier <felipeaggger@gmail.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
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" <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>,
daniel.almeida@collabora.com, rust-for-linux@vger.kernel.org,
felipe_life@live.com, linux-kernel@vger.kernel.org,
"Lyude Paul" <lyude@redhat.com>
Subject: Re: [PATCH v9] rust: add new macro for common bitflag operations
Date: Fri, 30 Jan 2026 06:36:48 -0300 [thread overview]
Message-ID: <a6a0a98e-d2b5-4245-b146-d2268b471e4f@gmail.com> (raw)
In-Reply-To: <CANiq72=GtVTbjuJ0g0+aUr-Ae91oK2PGVXqCkgch4MVL=ydgsQ@mail.gmail.com>
On 1/30/26 2:25 AM, Miguel Ojeda wrote:
> On Sat, Jan 17, 2026 at 11:41 AM Filipe Xavier <felipeaggger@gmail.com> wrote:
>> We have seen a proliferation of mod_whatever::foo::Flags
>> being defined with essentially the same implementation
>> for BitAnd, BitOr, contains and etc.
>>
>> This macro aims to bring a solution for this,
>> allowing to generate these methods for user-defined structs.
>> With some use cases in KMS and upcoming GPU drivers.
>>
>> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/We.20really.20need.20a.20common.20.60Flags.60.20type
>> Suggested-by: Daniel Almeida <daniel.almeida@collabora.com>
>> Suggested-by: Lyude Paul <lyude@redhat.com>
>> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
>> Reviewed-by: Lyude Paul <lyude@redhat.com>
>> Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
>> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
>> Signed-off-by: Filipe Xavier <felipeaggger@gmail.com>
> So I was about to apply this one and I noticed a few bits (no need for
> a new version):
>
> - This was added to the prelude -- I asked the team and they felt it
> wasn't needed, so I will remove it. We can always add it later on if
> needed.
Sounds good, no problem.
>
> - Is `BitXorAssign<$flag> for $flags` missing for some reason? I will add:
>
> impl ::core::ops::BitXorAssign<$flag> for $flags {
> #[inline]
> fn bitxor_assign(&mut self, rhs: $flag) {
> *self = *self ^ rhs;
> }
> }
>
> This is why I like to have tests for every operator... I may open
> a good first issue about it :)
Regarding |BitXorAssign|, that was indeed an oversight on my part.
Adding it makes perfect sense.
> I also fixed an intra-doc link and tweaked a couple other bits.
Thanks for the review and for taking the time with this.
Xavier
> Cheers,
> Miguel
next prev parent reply other threads:[~2026-01-30 9:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-17 10:41 Filipe Xavier
2026-01-30 5:25 ` Miguel Ojeda
2026-01-30 9:36 ` Filipe Xavier [this message]
2026-02-02 7:21 ` 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=a6a0a98e-d2b5-4245-b146-d2268b471e4f@gmail.com \
--to=felipeaggger@gmail.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=felipe_life@live.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®