Zhao Liu
0a7fe8d407
rust/qdev: Drop declare_properties & define_property macros
...
After HPET's #property conversion, there's no use case for
declare_properties & define_property. So get rid of them for now.
In future, if there's something that #property really cannot resolve,
they can be brought back.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-13-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Zhao Liu
b160ebadc1
rust/hpet: Convert qdev properties to #property macro
...
Convert HPET's properties to #property macro:
* num_timers: usize property.
* flags: u32 bit property.
* int_route_cap: u32 property.
* hpet_offset_saved: bool property.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-12-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Zhao Liu
4f09cf54fa
rust/hpet: Clean up type mismatch for num_timers property
...
Now `num_timers` is `usize` other than `u8`. Although the type field in
`declare_properties` macro hasn't been used, it's better to explicitly
point this out and clean up this before doing other property work.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-11-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Zhao Liu
a8f080215f
rust/qdev: Test bit property for #property
...
There's a diference between Rust and C:
Though C macro (e.g., DEFINE_PROP_BIT or DEFINE_PROP_BIT64) always
requires default value, Rust side allows to omit this "default" field
in #property, and provides a default value ("0" - false) for this
field.
This minor difference does not break user habits and should be
acceptable. Therefore, the test cases also cover this scenario.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-10-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Zhao Liu
9686aa9a05
rust/qdev: Support bit property in #property macro
...
Add BIT_INFO to QDevProp trait, so that bit related property info could
be bound to u32 & u64.
Then add "bit=*" field in #property attributes macro to allow device to
configure bit property.
In addtion, convert the #property field parsing from `if-else` pattern
to `match` pattern, to help readability. And note, the `bitnr` member of
`Property` struct is generated by manual TokenStream construction,
instead of conditional repetition (like #(bitnr: #bitnr,)?) since
`quote` doesn't support this.
In addtion, rename VALUE member of QDevProp trait to BASE_INFO.
And update the test cases about qdev property.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-9-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Zhao Liu
b4221e88a9
rust/qdev: Support property info for more common types
...
Add a helper macro to implement QDevProp trait for u8/u16/u32/usize/i32
/i64.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-8-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Manos Pitsidianakis
bed2a37b20
rust/qdev: Refine the documentation for QDevProp trait
...
Refine the documentation to clarify:
* `unsfae` requires that `VALUE` must be valid.
* using `*const` instead of `&` because the latter will cause compiler
error.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-7-zhao1.liu@intel.com
2025-09-22 17:17:19 +02:00
Manos Pitsidianakis
51d736cd71
rust/qdev: use addr_of! in QDevProp
...
We want a &raw pointer, so unsafe { &_ } is not needed.
Suggested-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-6-zhao1.liu@intel.com
2025-09-22 17:17:18 +02:00
Zhao Liu
35d7735f76
rust/common/uninit: Fix Clippy's complaints about lifetime
...
Clippy complains about the following cases and following its suggestion
to fix these warnings.
warning: the following explicit lifetimes could be elided: 'a
--> common/src/uninit.rs:38:6
|
38 | impl<'a, T, U> Deref for MaybeUninitField<'a, T, U> {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
|
38 - impl<'a, T, U> Deref for MaybeUninitField<'a, T, U> {
38 + impl<T, U> Deref for MaybeUninitField<'_, T, U> {
|
warning: the following explicit lifetimes could be elided: 'a
--> common/src/uninit.rs:49:6
|
49 | impl<'a, T, U> DerefMut for MaybeUninitField<'a, T, U> {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
49 - impl<'a, T, U> DerefMut for MaybeUninitField<'a, T, U> {
49 + impl<T, U> DerefMut for MaybeUninitField<'_, T, U> {
|
warning: `common` (lib) generated 2 warnings (run `cargo clippy --fix --lib -p common` to apply 2 suggestions)
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-5-zhao1.liu@intel.com
2025-09-22 17:17:18 +02:00
Zhao Liu
1bbac0ca88
rust/qemu-macros: Fix Clippy's complaints about lambda parameter naming
...
error: `rename` shadows a previous, unrelated binding
--> qemu-macros/src/lib.rs:265:14
|
265 | |rename| -> Result<proc_macro2::TokenStream, Error> {
| ^^^^^^
|
note: previous binding is here
--> qemu-macros/src/lib.rs:245:30
|
245 | let DeviceProperty { rename, defval } = prop;
| ^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
= note: requested on the command line with `-D clippy::shadow-unrelated`
Rename the lambda parameter to "prop_rename" to fix the above clippy
error.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20250920160520.3699591-4-zhao1.liu@intel.com
2025-09-22 17:17:18 +02:00
Paolo Bonzini
60c96a8775
rust: qemu-macros: switch #[property] parsing to use combinators
...
Since we are going to add more attribute parsing for high-level migration
state macros, use the attrs crate instead of a handwritten parser for
device properties as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-22 17:17:18 +02:00
Paolo Bonzini
193f2ab6e0
subprojects: add attrs crate
...
The attrs crate is a simple combinator-based for Rust attributes. It
will be used instead of a handwritten parser.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-22 17:17:18 +02:00
Paolo Bonzini
f87a2e5c59
rust: build: remove "protocol: rust: from doctests
...
It is added already by rust.doctest.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-22 17:17:18 +02:00
Paolo Bonzini
75dbe618ac
rust: vmstate: use "cast()" instead of "as"
...
Reported by clippy, fix it.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-22 17:17:18 +02:00
Paolo Bonzini
b9e8bb6637
rust: build: add back common and util tests
...
These were dropped by mistake when extracting the crates.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-22 17:17:18 +02:00
Paolo Bonzini
7c83e50156
rust: do not inline do_init_io
...
This is now possible since the hwcore integration tests do not
link the system crate anymore.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-34-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:58 +02:00
Paolo Bonzini
efe8d07383
rust: meson: remove unnecessary complication in device crates
...
It is not necessary anymore to explicitly list procedural macro crates
when doing the final link using rustc.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-33-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:58 +02:00
Marc-André Lureau
e4444d71e8
rust: re-export qemu macros from common/qom/hwcore
...
This is just a bit nicer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-22-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:58 +02:00
Marc-André Lureau
b0f6bf8a5b
rust: re-export qemu_macros internal helper in "bits"
...
Avoid the need to import "qemu_macros".
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-21-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
d58fcd05ff
rust: repurpose qemu_api -> tests
...
The crate purpose is only to provide integration tests at this point,
that can't easily be moved to a specific crate.
It's also often a good practice to have a single integration test crate
(see for ex https://github.com/rust-lang/cargo/issues/4867 )
Drop README.md, use docs/devel/rust.rst instead.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-20-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
966b1c302e
rust/pl011: drop dependency on qemu_api
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-19-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
960aaeb023
rust/hpet: drop now unneeded qemu_api dep
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-18-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
0d93f81773
rust: rename qemu_api_macros -> qemu_macros
...
Since "qemu_api" is no longer the unique crate to provide APIs.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-17-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
5e588c9d08
rust: split "hwcore" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-16-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
ee4ffbf239
rust: split "system" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-15-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
fef932ef09
rust: split "chardev" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-14-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
fcf4c00b4d
rust: split "qom" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250827104147.717203-13-marcandre.lureau@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
f6b4f0dd9c
rust: split "bql" crate
...
Unfortunately, an example had to be compile-time disabled, since it
relies on higher level crates (qdev, irq etc). The alternative is
probably to move that code to an example in qemu-api or elsewere and
make a link to it, or include_str.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-12-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
4dff343d23
rust: split "migration" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-11-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
59869b4d58
rust: split "util" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-7-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
1e70d83de4
rust: make build.rs generic over various ./rust/projects
...
Guess the name of the subdir from the manifest directory, instead of
hard-coding it. In the following commits, other crates can then link to
this file, instead of maintaining their own copy.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-5-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
593c408a6a
rust: split Rust-only "common" crate
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-6-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
a6765c04be
rust: move Cell vmstate impl
...
This will allow to split vmstate to a standalone crate next.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-10-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
0611dd418a
rust: move VMState handling to QOM module
...
This will allow to split vmstate to a standalone crate next.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-9-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
88cf78e917
rust: move vmstate_clock!() to qdev module
...
This will allow to split vmstate to a standalone crate next.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-8-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:57 +02:00
Marc-André Lureau
d85df9a8e2
rust: add workspace authors
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-4-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Marc-André Lureau
f665219b03
rust: remove unused global qemu "allocator"
...
The global allocator has always been disabled. There is no clear reason
Rust and C should use the same allocator. Allocations made from Rust
must be freed by Rust, and same for C, otherwise we head into troubles.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-3-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Marc-André Lureau
945bf29aa8
docs/rust: update msrv
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250827104147.717203-2-marcandre.lureau@redhat.com
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Paolo Bonzini
2a8a7bb8aa
rust: qdev: const_refs_to_static
...
Now that const_refs_static can be assumed, convert the members of
the DeviceImpl trait from functions to constants. This lets the
compiler know that they have a 'static lifetime, and removes the
need for the weird "Box::leak()".
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-10-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Paolo Bonzini
dcdee1e718
rust: vmstate: use const_refs_to_static
...
The VMStateDescriptionBuilder already needs const_refs_static, so
use it to remove the need for vmstate_clock! and vmstate_struct!,
as well as to simplify the implementation for scalars.
If the consts in the VMState trait can reference to static
VMStateDescription, scalars do not need the info_enum_to_ref!
indirection and structs can implement the VMState trait themselves.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-9-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Zhao Liu
7da9ee9207
rust: vmstate: convert to use builder pattern
...
Similar to MemoryRegionOps, the builder pattern has two advantages:
1) it makes it possible to build a VMStateDescription that knows which
types it will be invoked on; 2) it provides a way to wrap the callbacks
and let devices avoid "unsafe".
Unfortunately, building a static VMStateDescription requires the
builder methods to be "const", and because the VMStateFields are
*also* static, this requires const_refs_static. So this requires
Rust 1.83.0.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-8-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Manos Pitsidianakis
a71df7e143
rust: add qdev Device derive macro
...
Add derive macro for declaring qdev properties directly above the field
definitions. To do this, we split DeviceImpl::properties method on a
separate trait so we can implement only that part in the derive macro
expansion (we cannot partially implement the DeviceImpl trait).
Adding a `property` attribute above the field declaration will generate
a `qemu_api::bindings::Property` array member in the device's property
list.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/r/20250711-rust-qdev-properties-v3-1-e198624416fb@linaro.org
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Paolo Bonzini
aecca0676d
rust: use inline const expressions
...
They were stabilized in Rust 1.79.0.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-6-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Paolo Bonzini
71e84e5ae8
rust: add missing const markers for MSRV==1.83.0
...
Rust 1.83 allows more functions to be marked const.
Fix clippy with bumped minimum supported Rust version.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-5-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Paolo Bonzini
e1c689c218
meson, cargo: require Rust 1.83.0
...
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20250908105005.2119297-4-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-09-17 19:00:56 +02:00
Paolo Bonzini
92dedaf169
rust: move dependencies to rust/Cargo.toml
...
As more crates start using the same dependencies, it's better to not
repeat the versions and move the dependency declarations to the workspace.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-08-27 10:57:04 +02:00
Manos Pitsidianakis
4344b358a8
rust: declare self as qemu_api for proc-macros
...
Fix an outstanding TODO.
Declaring `extern crate self as qemu_api` allows use of `qemu_api`
within the qemu_api crate; this allows the Wrapper derive macro and
future proc macros to be used interchangeably in the qemu_api crate and
other crates. This is not required currently and is only for
future-proofing.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/r/20250728-self-as-qemu_api-v1-1-001c339cccc8@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-08-27 10:57:04 +02:00
Marc-André Lureau
96f2c80fed
rust/qemu-api-macros: make derive(Object) friendly when missing parent
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Link: https://lore.kernel.org/r/20250826133132.4064478-5-marcandre.lureau@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-08-27 10:57:04 +02:00
Paolo Bonzini
9a6d6ae8af
subprojects: update proc-macro2 and syn
...
syn 2.0.69 adds Punctuated::get(). The serde and attrs crate also need
a newer version.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-08-27 10:57:04 +02:00
Paolo Bonzini
2102780c55
rust: qemu-api-macros: support matching more than one error
...
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2025-08-27 10:57:04 +02:00