summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc
diff options
context:
space:
mode:
authorOnur Özkan <work@onurozkan.dev>2025-07-20 12:48:37 +0300
committerDanilo Krummrich <dakr@kernel.org>2025-08-15 19:58:51 +0200
commit8d3e8057eeadab134a71d6a495d6f1b6818144fe (patch)
tree949fa6176f0b3390f0ea660a1f0def77400f857b /rust/kernel/alloc
parenta55498c7d8a651ca5c7b8169e84d48af77e60723 (diff)
rust: make `ArrayLayout::new_unchecked` a `const fn`
Makes `ArrayLayout::new_unchecked` a `const fn` to allow compile-time evaluation. Signed-off-by: Onur Özkan <work@onurozkan.dev> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <lossin@kernel.org> Link: https://lore.kernel.org/r/20250720094838.29530-3-work@onurozkan.dev Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/alloc')
-rw-r--r--rust/kernel/alloc/layout.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/alloc/layout.rs b/rust/kernel/alloc/layout.rs
index 93ed514f7cc7..52cbf61c4539 100644
--- a/rust/kernel/alloc/layout.rs
+++ b/rust/kernel/alloc/layout.rs
@@ -80,7 +80,7 @@ impl<T> ArrayLayout<T> {
/// # Safety
///
/// `len` must be a value, for which `len * size_of::<T>() <= isize::MAX` is true.
- pub unsafe fn new_unchecked(len: usize) -> Self {
+ pub const unsafe fn new_unchecked(len: usize) -> Self {
// INVARIANT: By the safety requirements of this function
// `len * size_of::<T>() <= isize::MAX`.
Self {