From: sashiko-bot@kernel.org
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org,
"Alexandre Courbot" <acourbot@nvidia.com>,
gary@garyguo.net, "Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH v3 3/8] rust: alloc: add ArrayVec
Date: Mon, 28 Sep 2026 08:51:10 +0000 [thread overview]
Message-ID: <20260928085110.A159E1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260928-b4-nvkv-v3-3-f04504c262c2@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rust: alloc: missing #[inline] on small ArrayVec methods
--
commit 272001023e1b94a98c5055e880db10e4aff13e9a
Author: Eliot Courtney <ecourtney@nvidia.com>
rust: alloc: add ArrayVec
Adds a fixed capacity vector backed by an array of uninitialized memory. The
ArrayVec is also initializable with a closure to avoid constructing it on
the stack, which is useful for small varying size arrays on the stack or
larger ones initialized into caller-provided memory.
> diff --git a/rust/kernel/alloc/arrayvec.rs b/rust/kernel/alloc/arrayvec.rs
> new file mode 100644
> index 0000000000000..4172a982e4775
> --- /dev/null
> +++ b/rust/kernel/alloc/arrayvec.rs
[ ... ]
> + /// Appends an element to the back of the [`ArrayVec`].
> + ///
> + /// Fails when the [`ArrayVec`] is full, handing the element back in [`PushError`].
> + pub fn push(&mut self, v: T) -> Result<(), PushError<T>> {
[Severity: Low]
The rust subsystem coding guidelines recommend that small functions in
abstractions like the kernel crate be annotated with #[inline]. Since push
is a trivial wrapper around try_push_init, should it have an #[inline]
annotation to avoid sub-optimal inlining?
> + self.try_push_init(v)
> + .map_err(|PushInitError::Full(v)| PushError(v))
> + }
> +
> + /// Appends an element to the back of the [`ArrayVec`] by initializing it in place.
> + ///
> + /// Fails with [`FullError`] when the [`ArrayVec`] is full.
> + pub fn push_init(&mut self, init: impl Init<T>) -> Result<(), FullError> {
[Severity: Low]
Similarly, push_init is a trivial wrapper around try_push_init. Would it be
appropriate to add an #[inline] annotation here as well?
> + self.try_push_init(init)
> + .map_err(|PushInitError::Full(_)| FullError)
> + }
[ ... ]
> + /// Returns a slice of `MaybeUninit<T>` for the remaining spare capacity of the [`ArrayVec`].
> + fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>] {
[Severity: Low]
Since spare_capacity_mut is a small internal helper returning a slice,
should it also be annotated with #[inline]?
> + // PANIC: `len` never exceeds `N` by the type invariants.
> + &mut self.data[self.len..]
> + }
> +}
[ ... ]
> +impl<T, const N: usize> Borrow<[T]> for ArrayVec<T, N> {
> + fn borrow(&self) -> &[T] {
[Severity: Low]
This trait method is a one-line wrapper around as_slice. Does it need an
#[inline] annotation following the coding guidelines?
> + self.as_slice()
> + }
> +}
[ ... ]
> +impl<'a, T, const N: usize> IntoIterator for &'a ArrayVec<T, N> {
> + type Item = &'a T;
> + type IntoIter = slice::Iter<'a, T>;
> +
> + fn into_iter(self) -> Self::IntoIter {
[Severity: Low]
This trait method is a one-line wrapper around iter. Should an #[inline]
annotation be added here?
> + self.iter()
> + }
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260928-b4-nvkv-v3-0-f04504c262c2@nvidia.com?part=3
next prev parent reply other threads:[~2026-09-28 8:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 8:42 [PATCH v3 0/8] gpu: nova-core: add NVKV codec Eliot Courtney
2026-09-28 8:42 ` [PATCH v3 1/8] rust: alloc: add Vec::try_push_init Eliot Courtney
2026-09-28 8:51 ` sashiko-bot
2026-10-06 5:52 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 2/8] rust: alloc: add Vec::push_init Eliot Courtney
2026-09-28 8:52 ` sashiko-bot
2026-10-06 6:10 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 3/8] rust: alloc: add ArrayVec Eliot Courtney
2026-09-28 8:51 ` sashiko-bot [this message]
2026-10-07 6:27 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 4/8] gpu: nova-core: add NVKV encoder Eliot Courtney
2026-09-28 8:52 ` sashiko-bot
2026-10-07 3:43 ` Alexandre Courbot
2026-10-07 3:48 ` Alexandre Courbot
2026-10-07 11:33 ` John Hubbard
2026-10-07 11:56 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 5/8] gpu: nova-core: add NVKV decoder Eliot Courtney
2026-09-28 8:52 ` sashiko-bot
2026-10-07 4:51 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 6/8] gpu: nova-core: add NVKV typed encoding Eliot Courtney
2026-10-07 6:30 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 7/8] gpu: nova-core: add NVKV typed decoding Eliot Courtney
2026-10-07 6:30 ` Alexandre Courbot
2026-10-07 12:05 ` Alexandre Courbot
2026-09-28 8:42 ` [PATCH v3 8/8] gpu: nova-core: add NVKV GSP_INIT schemas Eliot Courtney
2026-10-07 10:53 ` 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=20260928085110.A159E1F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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