linux-stable/rust
Miguel Ojeda a9bff7e674 rust: alloc: fix rusttest by providing Cmalloc::aligned_layout too
[ Upstream commit 0f580d5d3d ]

Commit fde578c862 ("rust: alloc: replace aligned_size() with
Kmalloc::aligned_layout()") provides a public `aligned_layout` function
in `Kamlloc`, but not in `Cmalloc`, and thus uses of it will trigger an
error in `rusttest`.

Such a user appeared in the following commit 22ab0641b9 ("rust: drm:
ensure kmalloc() compatible Layout"):

    error[E0599]: no function or associated item named `aligned_layout` found for struct `alloc::allocator_test::Cmalloc` in the current scope
       --> rust/kernel/drm/device.rs💯31
        |
    100 |         let layout = Kmalloc::aligned_layout(Layout:🆕:<Self>());
        |                               ^^^^^^^^^^^^^^ function or associated item not found in `Cmalloc`
        |
       ::: rust/kernel/alloc/allocator_test.rs:19:1
        |
    19  | pub struct Cmalloc;
        | ------------------ function or associated item `aligned_layout` not found for this struct

Thus add an equivalent one for `Cmalloc`.

Fixes: fde578c862 ("rust: alloc: replace aligned_size() with Kmalloc::aligned_layout()")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/r/20250816204215.2719559-1-ojeda@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:34:46 +02:00
..
bindings rust: completion: implement initial abstraction 2025-06-13 23:46:56 +02:00
helpers Driver core fixes for 6.16-rc3 2025-06-18 14:31:16 -07:00
kernel rust: alloc: fix rusttest by providing Cmalloc::aligned_layout too 2025-08-28 16:34:46 +02:00
macros rust: use #[used(compiler)] to fix build and modpost with Rust >= 1.89.0 2025-07-14 23:30:44 +02:00
pin-init
uapi drm for 6.16-rc1 2025-05-28 09:46:39 -07:00
.gitignore
.kunitconfig
bindgen_parameters
build_error.rs
compiler_builtins.rs
exports.c
ffi.rs rust: use absolute paths in macros referencing core and kernel 2025-05-23 00:12:14 +02:00
Makefile rust: workaround rustdoc target modifiers bug 2025-08-20 18:41:35 +02:00