Commit c28afde0 authored by Alice Ryhl's avatar Alice Ryhl Committed by Matthew Maurer
Browse files

FROMGIT: rust: alloc: add Vec::remove



This is needed by Rust Binder in the range allocator, and by upcoming
GPU drivers during firmware initialization.

Panics in the kernel are best avoided when possible, so an error is
returned if the index is out of bounds. An error type is used rather
than just returning Option<T> to let callers handle errors with ?.

Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarBenno Lossin <lossin@kernel.org>
Link: https://lore.kernel.org/r/20250502-vec-methods-v5-6-06d20ad9366f@google.com


[ Remove `# Panics` section; `Vec::remove() handles the error properly.`
  - Danilo ]
Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>

Bug: 414994413
(cherry picked from commit 294a7ecb
 https://github.com/Rust-for-Linux/linux.git

 alloc-next)
Change-Id: I80a8925910f234cccd325614634aa8a12e85ea1c
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent e1da6035
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment