Tell clippy the minimum supported Rust version for QEMU.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/hw/char/pl011/Cargo.toml | 1 +
rust/hw/char/pl011/src/device_class.rs | 1 -
rust/qemu-api-macros/Cargo.toml | 1 +
rust/qemu-api/Cargo.toml | 1 +
4 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/rust/hw/char/pl011/Cargo.toml b/rust/hw/char/pl011/Cargo.toml
index 2b4097864df..f2296cad58b 100644
--- a/rust/hw/char/pl011/Cargo.toml
+++ b/rust/hw/char/pl011/Cargo.toml
@@ -9,6 +9,7 @@ resolver = "2"
publish = false
keywords = []
categories = []
+rust-version = "1.63.0"
[lib]
crate-type = ["staticlib"]
diff --git a/rust/hw/char/pl011/src/device_class.rs b/rust/hw/char/pl011/src/device_class.rs
index 8a157a663fb..dbef93f6cb3 100644
--- a/rust/hw/char/pl011/src/device_class.rs
+++ b/rust/hw/char/pl011/src/device_class.rs
@@ -12,7 +12,6 @@
use crate::device::{PL011Registers, PL011State};
-#[allow(clippy::missing_const_for_fn)]
extern "C" fn pl011_clock_needed(opaque: *mut c_void) -> bool {
let state = NonNull::new(opaque).unwrap().cast::<PL011State>();
unsafe { state.as_ref().migrate_clock }
diff --git a/rust/qemu-api-macros/Cargo.toml b/rust/qemu-api-macros/Cargo.toml
index b9b4baecddb..89dee1cfb39 100644
--- a/rust/qemu-api-macros/Cargo.toml
+++ b/rust/qemu-api-macros/Cargo.toml
@@ -9,6 +9,7 @@ resolver = "2"
publish = false
keywords = []
categories = []
+rust-version = "1.63.0"
[lib]
proc-macro = true
diff --git a/rust/qemu-api/Cargo.toml b/rust/qemu-api/Cargo.toml
index 4aa22f31986..a51dd142852 100644
--- a/rust/qemu-api/Cargo.toml
+++ b/rust/qemu-api/Cargo.toml
@@ -12,6 +12,7 @@ resolver = "2"
publish = false
keywords = []
categories = []
+rust-version = "1.63.0"
[dependencies]
qemu_api_macros = { path = "../qemu-api-macros" }
--
2.48.1
> diff --git a/rust/hw/char/pl011/src/device_class.rs b/rust/hw/char/pl011/src/device_class.rs
> index 8a157a663fb..dbef93f6cb3 100644
> --- a/rust/hw/char/pl011/src/device_class.rs
> +++ b/rust/hw/char/pl011/src/device_class.rs
> @@ -12,7 +12,6 @@
>
> use crate::device::{PL011Registers, PL011State};
>
> -#[allow(clippy::missing_const_for_fn)]
It seems like a rebase nit since the commit 7d0520398f7f ("rust: prefer
NonNull::new to assertions"), which is not worth an extra commit either.
> extern "C" fn pl011_clock_needed(opaque: *mut c_void) -> bool {
> let state = NonNull::new(opaque).unwrap().cast::<PL011State>();
> unsafe { state.as_ref().migrate_clock }
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Il gio 6 feb 2025, 11:42 Zhao Liu <zhao1.liu@intel.com> ha scritto:
> > diff --git a/rust/hw/char/pl011/src/device_class.rs
> b/rust/hw/char/pl011/src/device_class.rs
> > index 8a157a663fb..dbef93f6cb3 100644
> > --- a/rust/hw/char/pl011/src/device_class.rs
> > +++ b/rust/hw/char/pl011/src/device_class.rs
> > @@ -12,7 +12,6 @@
> >
> > use crate::device::{PL011Registers, PL011State};
> >
> > -#[allow(clippy::missing_const_for_fn)]
>
> It seems like a rebase nit since the commit 7d0520398f7f ("rust: prefer
> NonNull::new to assertions"), which is not worth an extra commit either.
>
It's not; adding rust_version let's Clippy know that this function cannot
be const in all supported versions of the standard library.
Paolo
> extern "C" fn pl011_clock_needed(opaque: *mut c_void) -> bool {
> > let state = NonNull::new(opaque).unwrap().cast::<PL011State>();
> > unsafe { state.as_ref().migrate_clock }
>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>
>
© 2016 - 2026 Red Hat, Inc.