Jesung Yang
unread,May 27, 2025, 9:56:18 AM5/27/25Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-k...@vger.kernel.org, kuni...@googlegroups.com, rust-fo...@vger.kernel.org, linux-...@vger.kernel.org, Jesung Yang
Hi,
On Tue, May 27, 2025 at 9:06 PM Benno Lossin <
los...@kernel.org> wrote:
>
> We don't need to explicitly import it, as `c_void` is present in the
> prelude since 3d5bef5d47c3 ("rust: add C FFI types to the prelude").
The base commit of my patch is f4daa80d6be7 ("rust: compile libcore with
edition 2024 for 1.87+"), which unfortunately predates the addition of
`use crate::prelude::*`. As a result, removing `use kernel::ffi::c_void`
causes the build to fail with the following error:
```
error[E0412]: cannot find type `c_void` in this scope
--> rust/kernel/kunit.rs:22:41
|
22 | &args as *const _ as *const c_void,
| ^^^^^^ not found in this scope
|
help: consider importing one of these enums
|
9 + use crate::prelude::c_void;
|
9 + use core::ffi::c_void;
|
9 + use ffi::c_void;
|
error[E0412]: cannot find type `c_void` in this scope
--> rust/kernel/kunit.rs:38:41
|
38 | &args as *const _ as *const c_void,
| ^^^^^^ not found in this scope
|
help: consider importing one of these enums
|
9 + use crate::prelude::c_void;
|
9 + use core::ffi::c_void;
|
9 + use ffi::c_void;
|
error: aborting due to 2 previous errors
```
Starting from commit c4c0574ee33b ("rust: add `kunit_tests` to the
prelude"), we do have `use crate::prelude::*;`, so the explicit import
is no longer necessary in that context.
Thanks for pointing this out!
Best regards,
Jesung