From: "Benno Lossin" <lossin@kernel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Christian" <christiansantoslima21@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>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
~lkcamp/patches@lists.sr.ht, richard120310@gmail.com
Subject: Re: [PATCH v7] rust: transmute: Add methods for FromBytes trait
Date: Wed, 18 Jun 2025 21:29:33 +0200 [thread overview]
Message-ID: <DAPWP2IC7HZ1.F1GYTSUGD8WN@kernel.org> (raw)
In-Reply-To: <CANiq72kY=sSnhzYPRo3Zuj-7RjULMpRfCBYfoDDCpCHttX-3-A@mail.gmail.com>
On Mon Jun 16, 2025 at 11:23 PM CEST, Miguel Ojeda wrote:
> On Mon, Jun 16, 2025 at 11:11 PM Christian
> <christiansantoslima21@gmail.com> wrote:
>>
>> I mean, using something like `use core::mem;` globally since we use a
>> lot of core stuff and so, it would make the code less verbose just
>> importing size_of, align_of and etc.
>
> Do you mean adding some more `core` bits to the `kernel` prelude?
> Yeah, we are always considering which ones to add -- if you want to
> propose particular ones, then it can be discussed of course. Perhaps
> in Zulip?
>
> However, since these are macros, unless we get a proper custom prelude
> feature in the compiler (which we requested a long time ago), we
> probably want to still to refer to everything in full, even if it is
> in the `kernel` prelude.
Yes, the prelude won't have precedence over locally defined items. So if
someone does
mod core {}
your_macro_that_uses_core!(); // <-- will error with `core::mem` not existing
However in this particular case it seems like that the macro
`impl_frombytes` is a local to this file. In that case it might be fine
to rely on imports from the scope.
---
Cheers,
Benno
next prev parent reply other threads:[~2025-06-18 19:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-15 7:20 [PATCH v7] rust: transmute: Add methods for FromBytes trait Every2
2025-06-15 9:34 ` Miguel Ojeda
2025-06-16 20:07 ` Christian
2025-06-16 20:42 ` Miguel Ojeda
2025-06-16 21:11 ` Christian
2025-06-16 21:23 ` Miguel Ojeda
2025-06-18 19:29 ` Benno Lossin [this message]
2025-06-19 19:31 ` Miguel Ojeda
2025-06-15 17:12 ` kernel test robot
2025-06-16 8:09 ` Alexandre Courbot
2025-06-16 19:57 ` Christian
2025-06-17 1:15 ` Alexandre Courbot
2025-06-17 1:55 ` Christian
2025-06-17 7:39 ` 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=DAPWP2IC7HZ1.F1GYTSUGD8WN@kernel.org \
--to=lossin@kernel.org \
--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=christiansantoslima21@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=richard120310@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--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;
as well as URLs for NNTP newsgroup(s).