Skip to contentSkip to conversation

Rust ALLOC for v6.16

GIT PULL Applied Danilo Krummrich 2 participants 2 messages May 13, 2025 – May 18, 2025 Rust

lore
Share & tools
lore

Danilo Krummrich

author reviewer
#0 lore raw

Hi Miguel,

Please pull the following ALLOC changes.

Most of them are new methods for Vec, required by binder and nova-core.

All commits have been in linux-next for at least a few days -- no conflicts expected.

- Danilo

The following changes since commit 0af2f6be1b4281385b618cb86ad946eded089ac8:

Linux 6.15-rc1 (2025-04-06 13:11:33 -0700)

are available in the Git repository at:

https://github.com/Rust-for-Linux/linux.git tags/alloc-next-v6.16-2025-05-13

for you to fetch changes up to 771c5a7d9843643b035938624050e7769133b9cc:

rust: alloc: add Vec::insert_within_capacity (2025-05-07 18:40:45 +0200)

----------------------------------------------------------------
Alloc changes for v6.16

Box:
- support for type coercion, e.g. Box<T> to Box<dyn U> if T implements U

Vec:
- implement new methods (prerequisites for nova-core and binder)
- Vec::truncate()
- Vec::resize()
- Vec::clear()
- Vec::pop()
- Vec::push_within_capacity()
- new error type: PushError
- Vec::drain_all()
- Vec::retain()
- Vec::remove()
- new error type: RemoveError
- Vec::insert_within_capacity
- new error type: InsertError
- simplify Vec::push() using Vec::spare_capacity_mut()
- split Vec::set_len() into Vec::inc_len() and Vec::dec_len()
- add type invariant Vec::len() <= Vec::capacity
- simplify Vec::truncate() using Vec::dec_len()

----------------------------------------------------------------
Alexandre Courbot (1):
rust: alloc: allow coercion from Box<T> to Box<dyn U> if T implements U

Alice Ryhl (7):
rust: alloc: add Vec::clear
rust: alloc: add Vec::pop
rust: alloc: add Vec::push_within_capacity
rust: alloc: add Vec::drain_all
rust: alloc: add Vec::retain
rust: alloc: add Vec::remove
rust: alloc: add Vec::insert_within_capacity

Andrew Ballance (2):
rust: alloc: add Vec::truncate method
rust: alloc: add Vec::resize method

Danilo Krummrich (1):
rust: alloc: add missing invariant in Vec::set_len()

Tamir Duberstein (5):
rust: alloc: use spare_capacity_mut to reduce unsafe
rust: alloc: add Vec::len() <= Vec::capacity invariant
rust: alloc: add Vec::dec_len
rust: alloc: refactor Vec::truncate using dec_len
rust: alloc: replace Vec::set_len with inc_len

 rust/kernel/alloc/kbox.rs        |  40 ++++++++++-
 rust/kernel/alloc/kvec.rs        | 430 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 rust/kernel/alloc/kvec/errors.rs |  61 +++++++++++++++++
 rust/kernel/str.rs               |   2 +-
 rust/kernel/uaccess.rs           |   2 +-
 5 files changed, 506 insertions(+), 29 deletions(-)
 create mode 100644 rust/kernel/alloc/kvec/errors.rs