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

Reply via email to