Rust for Linux List
 help / color / mirror / Atom feed
From: Jesung Yang <y.j3ms.n@gmail.com>
To: "Brendan Higgins" <brendan.higgins@linux.dev>,
	"David Gow" <davidgow@google.com>, "Rae Moar" <rmoar@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jesung Yang <y.j3ms.n@gmail.com>
Subject: Re: [PATCH] rust: kunit: use crate-level mapping for `c_void`
Date: Tue, 27 May 2025 13:55:49 +0000	[thread overview]
Message-ID: <20250527135549.1982244-1-y.j3ms.n@gmail.com> (raw)
In-Reply-To: <DA6XI37GNRHE.1FN5893KE2OIG@kernel.org>

Hi,

On Tue, May 27, 2025 at 9:06 PM Benno Lossin <lossin@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

      parent reply	other threads:[~2025-05-27 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-26 16:24 [PATCH] rust: kunit: use crate-level mapping for `c_void` Jesung Yang
2025-05-26 16:32 ` Miguel Ojeda
2025-05-27 12:06 ` Benno Lossin
2025-05-27 13:51   ` Miguel Ojeda
2025-05-27 20:38     ` Benno Lossin
2025-05-27 13:55   ` Jesung Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250527135549.1982244-1-y.j3ms.n@gmail.com \
    --to=y.j3ms.n@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brendan.higgins@linux.dev \
    --cc=dakr@kernel.org \
    --cc=davidgow@google.com \
    --cc=gary@garyguo.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rmoar@google.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox