[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250527135549.1982244-1-y.j3ms.n@gmail.com>
Date: Tue, 27 May 2025 13:55:49 +0000
From: Jesung Yang <y.j3ms.n@...il.com>
To: Brendan Higgins <brendan.higgins@...ux.dev>,
David Gow <davidgow@...gle.com>,
Rae Moar <rmoar@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>
Cc: linux-kselftest@...r.kernel.org,
kunit-dev@...glegroups.com,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jesung Yang <y.j3ms.n@...il.com>
Subject: Re: [PATCH] rust: kunit: use crate-level mapping for `c_void`
Hi,
On Tue, May 27, 2025 at 9:06 PM Benno Lossin <lossin@...nel.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
Powered by blists - more mailing lists