qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-rust@nongnu.org, Bernhard Beschow <shentey@gmail.com>
Subject: [PATCH v3 4/4] rust/qemu-api: Fix clippy lint `missing_const_for_fn`
Date: Sun, 15 Jun 2025 13:20:37 +0200	[thread overview]
Message-ID: <20250615112037.11992-5-shentey@gmail.com> (raw)
In-Reply-To: <20250615112037.11992-1-shentey@gmail.com>

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 rust/qemu-api/src/cell.rs | 2 +-
 rust/qemu-api/src/qom.rs  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/qemu-api/src/cell.rs b/rust/qemu-api/src/cell.rs
index 27063b049d..851573f8ef 100644
--- a/rust/qemu-api/src/cell.rs
+++ b/rust/qemu-api/src/cell.rs
@@ -965,7 +965,7 @@ impl<T> Opaque<T> {
     /// # Safety
     ///
     /// The pointer must be valid, though it need not point to a valid value.
-    pub unsafe fn from_raw<'a>(ptr: *mut T) -> &'a Self {
+    pub const unsafe fn from_raw<'a>(ptr: *mut T) -> &'a Self {
         let ptr = NonNull::new(ptr).unwrap().cast::<Self>();
         // SAFETY: Self is a transparent wrapper over T
         unsafe { ptr.as_ref() }
diff --git a/rust/qemu-api/src/qom.rs b/rust/qemu-api/src/qom.rs
index 14f98fee60..29d1b02720 100644
--- a/rust/qemu-api/src/qom.rs
+++ b/rust/qemu-api/src/qom.rs
@@ -634,7 +634,7 @@ impl<T: ObjectType> Owned<T> {
     /// back to `from_raw()` (assuming the original `Owned` was valid!),
     /// since the owned reference remains there between the calls to
     /// `into_raw()` and `from_raw()`.
-    pub unsafe fn from_raw(ptr: *const T) -> Self {
+    pub const unsafe fn from_raw(ptr: *const T) -> Self {
         // SAFETY NOTE: while NonNull requires a mutable pointer, only
         // Deref is implemented so the pointer passed to from_raw
         // remains const
-- 
2.49.0



      parent reply	other threads:[~2025-06-15 11:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-15 11:20 [PATCH v3 0/4] Initial logging support for Rust Bernhard Beschow
2025-06-15 11:20 ` [PATCH v3 1/4] rust/qemu-api: Add initial logging support based on C API Bernhard Beschow
2025-06-15 11:20 ` [PATCH v3 2/4] rust/hw/char/pl011/src/device: Implement logging Bernhard Beschow
2025-06-15 11:20 ` [PATCH v3 3/4] rust/hw/char/pl011/src/device: Add missing logging to match C version Bernhard Beschow
2025-06-15 11:20 ` Bernhard Beschow [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=20250615112037.11992-5-shentey@gmail.com \
    --to=shentey@gmail.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-rust@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).