2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/rust/kernel
Tamir Duberstein 47a17a63f9 rust: alloc: add Vec::len() <= Vec::capacity invariant
Document the invariant that the vector's length is always less than or
equal to its capacity. This is already implied by these other
invariants:

- `self.len` always represents the exact number of elements stored in
  the vector.
- `self.layout` represents the absolute number of elements that can be
  stored within the vector without re-allocation.

but it doesn't hurt to spell it out. Note that the language references
`self.capacity` rather than `self.layout.len` as the latter is zero for
a vector of ZSTs.

Update a safety comment touched by this patch to correctly reference
`realloc` rather than `alloc` and replace "leaves" with "leave" to
improve grammar.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250416-vec-set-len-v4-1-112b222604cd@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2025-04-23 12:05:15 +02:00
..
alloc rust: alloc: add Vec::len() <= Vec::capacity invariant 2025-04-23 12:05:15 +02:00
block rust: block: refactor to use &raw mut 2025-03-23 20:39:37 +01:00
fs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
list rust: use derive(CoercePointee) on rustc >= 1.84.0 2025-01-13 23:45:30 +01:00
net rust: module: introduce authors key 2025-03-10 15:12:17 +01:00
sync Rust changes for v6.15 2025-03-30 17:03:26 -07:00
time Rust hrtimer API for v6.15 2025-03-25 23:41:14 +01:00
.gitignore rust: jump_label: skip formatting generated file 2024-11-20 13:32:42 -05:00
alloc.rs rust: use derive(CoercePointee) on rustc >= 1.84.0 2025-01-13 23:45:30 +01:00
block.rs rust: block: introduce kernel::block::mq module 2024-06-14 07:45:04 -06:00
build_assert.rs rust: add build_error! to the prelude 2025-01-10 00:19:09 +01:00
cred.rs cred,rust: mark Credential methods inline 2025-03-04 17:07:49 -05:00
device_id.rs rust: implement IdArray, IdTable and RawDeviceId 2024-12-20 17:19:25 +01:00
device.rs rust: device: implement device context marker 2025-03-17 08:04:25 +01:00
devres.rs rust: io: fix devres test with new io accessor functions 2025-02-25 07:29:48 +01:00
dma.rs rust: dma: add Send implementation for CoherentAllocation 2025-03-24 20:14:10 +01:00
driver.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
error.rs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
faux.rs rust/kernel/faux: mark Registration methods inline 2025-03-11 10:42:23 +01:00
firmware.rs rust: firmware: add module_firmware! macro 2025-03-09 19:23:31 +01:00
fs.rs rust: file: add Rust abstraction for struct file 2024-09-30 13:02:28 +02:00
generated_arch_static_branch_asm.rs.S rust: jump_label: skip formatting generated file 2024-11-20 13:32:42 -05:00
init.rs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
io.rs rust: io: rename io::Io accessors 2025-02-22 15:44:19 +01:00
ioctl.rs rust: start using the #[expect(...)] attribute 2024-10-07 21:39:57 +02:00
jump_label.rs rust: jump_label: skip formatting generated file 2024-11-20 13:32:42 -05:00
kunit.rs rust: kunit: allow to know if we are in a test 2025-03-20 12:27:05 +01:00
lib.rs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
list.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
miscdevice.rs rust: miscdevice: change how f_ops vtable is constructed 2025-03-07 18:20:36 +01:00
net.rs rust: core abstractions for network PHY drivers 2023-12-15 09:35:50 +00:00
of.rs rust: of: add of::DeviceId abstraction 2024-12-20 17:21:04 +01:00
page.rs rust: page: remove unnecessary helper function from doctest 2025-01-13 23:44:55 +01:00
pci.rs Driver core updates for 6.15-rc1 2025-04-01 11:02:03 -07:00
pid_namespace.rs rust: add PidNamespace 2024-10-08 15:44:36 +02:00
platform.rs Driver core updates for 6.15-rc1 2025-04-01 11:02:03 -07:00
prelude.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
print.rs print: use new #[export] macro for rust_fmt_argument 2025-03-09 20:52:46 +01:00
rbtree.rs rust: rbtree: fix comments referring to Box instead of KBox 2025-03-23 19:43:02 +01:00
revocable.rs rust: add Revocable type 2024-12-20 17:19:26 +01:00
security.rs lsm,rust: reword "destroy" -> "release" in SecurityCtx 2025-03-04 15:44:46 -05:00
seq_file.rs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
sizes.rs rust: sizes: add commonly used constants 2024-08-30 10:27:34 +01:00
static_assert.rs rust: static_assert: add static_assert! macro 2022-12-04 01:59:16 +01:00
std_vendor.rs rust: std_vendor: update dbg macro from Rust upstream 2024-10-10 00:33:42 +02:00
str.rs rust: str: implement strip_prefix for BStr 2025-03-20 21:44:47 +01:00
sync.rs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
task.rs Rust changes for v6.15 2025-03-30 17:03:26 -07:00
time.rs rust: hrtimer: add clocksource selection through ClockId 2025-03-22 12:08:54 +01:00
tracepoint.rs rust: add tracepoint support 2024-11-04 16:21:44 -05:00
transmute.rs rust: kernel: move FromBytes and AsBytes traits to a new transmute module 2024-10-10 00:33:42 +02:00
types.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
uaccess.rs rust: uaccess: name the correct function 2025-03-23 19:45:03 +01:00
workqueue.rs Locking changes for v6.15: 2025-03-24 20:55:03 -07:00