This is the preview of moving the minimum supported Rust version forward to 1.83.0, which is the target for QEMU due to its support for the const_refs_to_static feature.
Being able to autogenerate all the reflection-like structs in qdev and VMState improves the type safety, but also requires annotating the types with the information needed to generate the structs. The const_refs_to_static feature is needed because this information resides in constants that refer to global variables (of types such as PropertyInfo, VMStateField or VMStateDescription). This series does not cover enabling the newer compiler in CI because, while both Debian and Ubuntu have a new-enough Rust compiler to support 1.77, they pose problems for this further bump. For Debian, the bookworm release probably will not have new compilers and is supported by QEMU for roughly two more years. For Ubuntu, the situation is a bit weird because while Ubuntu 22.04 had new Rust compilers added until the summer of 2024, Ubuntu 24.04 is not adding packages for new versions. A possible plan here is to split the configuration between "enable Rust" and "enable all devices written in Rust" as soon as new devices are contributed that are written in Rust. This way, the C versions of the pl011 and HPET devices can be used but the new boards/devices would only be available on Debian or Ubuntu by using rustup. This series does not use *all* features enabled between 1.77 and 1.83; in particular it does not replace addr_of!/addr_of_mut! with "&raw" expressions. Paolo Paolo Bonzini (5): meson, cargo: require Rust 1.83.0 rust: use inline const expressions rust: vmstate: convert to use builder pattern rust: vmstate: use const_refs_to_static rust: qdev: const_refs_to_static docs/devel/rust.rst | 30 +- meson.build | 6 +- rust/Cargo.toml | 2 +- rust/clippy.toml | 2 +- rust/hw/char/pl011/src/device.rs | 20 +- rust/hw/char/pl011/src/device_class.rs | 123 +++---- rust/hw/timer/hpet/src/hpet.rs | 173 ++++------ rust/qemu-api/src/assertions.rs | 4 - rust/qemu-api/src/callbacks.rs | 27 +- rust/qemu-api/src/chardev.rs | 2 +- rust/qemu-api/src/qdev.rs | 16 +- rust/qemu-api/src/timer.rs | 2 +- rust/qemu-api/src/vmstate.rs | 432 +++++++++++++++---------- rust/qemu-api/tests/tests.rs | 20 +- rust/qemu-api/tests/vmstate_tests.rs | 155 +++++---- 15 files changed, 517 insertions(+), 497 deletions(-) -- 2.49.0