Debian bookworm provides Rust 1.78 on all architectures except for mips64el,
as part of its packaging of Firefox. Michael Tokarev confirmed that
it is not a problem at this point to require a rustup-based toolchain
when building for mips64el on bookworm.
This series therefore updates the minimum supported Rust version
to 1.77 (since 1.78 does not really add anything that QEMU needs).
It removes several temporary compatibility shims (including offset_of)
and enables the introduction of some more modern idioms, for example
cast_const()/cast_mut() and "let ... else". These were useful as early
experiments with procedural macros and with supporting old versions of
Rust, but are not needed anymore.
The remaining major obstacle is const_refs_static, which was stabilized
in 1.83.0 and allows for much-improved vmstate bindings. These were
prototyped by Zhao and myself and I'll post them shortly for reference.
It's unlikely that Debian bookworm will update rustc-web any further,
since the next Firefox ESR version is expected roughly at the same time
as the Debian trixie release.
Paolo
v1->v2:
* rebase on top of "rust: centralize config in workspace root"
* also adjust Dockerfile for Ubuntu 22.04
* extract separate patch to require Rust 1.77.0 in Meson and Cargo
* fix TODO about zeroability of classes
* use "let ... else" more (and better) in qemu_api_macros
* run everything through rustfmt
* place ptr_cast_constness patch earlier, since cast_mut()/cast_const()
were introduced before offset_of and c"" literals
Paolo Bonzini (11):
lcitool: use newer Rust for Debian and Ubuntu
meson, cargo: require Rust 1.77.0
rust: use std::ffi instead of std::os::raw
rust: let bilge use "let ... else"
rust: qemu_api_macros: make pattern matching more readable and
efficient
rust: use MaybeUninit::zeroed() in const context
rust: qom: fix TODO about zeroability of classes
rust: enable clippy::ptr_cast_constness
rust: remove offset_of replacement
rust: replace c_str! with c"" literals
docs: rust: update for newer minimum supported version
docs/about/build-platforms.rst | 11 +-
docs/devel/rust.rst | 38 +---
meson.build | 6 +-
rust/Cargo.lock | 1 -
rust/Cargo.toml | 6 +-
rust/clippy.toml | 2 +-
rust/hw/char/pl011/src/device.rs | 4 +-
rust/hw/char/pl011/src/device_class.rs | 13 +-
rust/hw/char/pl011/src/lib.rs | 6 +-
rust/hw/timer/hpet/src/fw_cfg.rs | 6 +-
rust/hw/timer/hpet/src/hpet.rs | 28 ++-
rust/hw/timer/hpet/src/lib.rs | 4 +-
rust/qemu-api-macros/src/lib.rs | 113 ++++--------
rust/qemu-api/Cargo.toml | 3 -
rust/qemu-api/build.rs | 7 -
rust/qemu-api/meson.build | 5 -
rust/qemu-api/src/c_str.rs | 61 -------
rust/qemu-api/src/cell.rs | 6 +-
rust/qemu-api/src/chardev.rs | 5 +-
rust/qemu-api/src/irq.rs | 6 +-
rust/qemu-api/src/lib.rs | 7 +-
rust/qemu-api/src/memory.rs | 3 +-
rust/qemu-api/src/offset_of.rs | 168 ------------------
rust/qemu-api/src/qdev.rs | 9 +-
rust/qemu-api/src/qom.rs | 14 +-
rust/qemu-api/src/timer.rs | 4 +-
rust/qemu-api/src/vmstate.rs | 14 +-
rust/qemu-api/src/zeroable.rs | 104 ++---------
rust/qemu-api/tests/tests.rs | 11 +-
rust/qemu-api/tests/vmstate_tests.rs | 27 +--
.../ci/setup/ubuntu/ubuntu-2204-aarch64.yaml | 2 +-
.../ci/setup/ubuntu/ubuntu-2204-s390x.yaml | 2 +-
subprojects/bilge-impl-0.2-rs.wrap | 1 -
.../packagefiles/bilge-impl-1.63.0.patch | 45 -----
.../dockerfiles/debian-amd64-cross.docker | 2 +-
.../dockerfiles/debian-arm64-cross.docker | 2 +-
.../dockerfiles/debian-armhf-cross.docker | 2 +-
.../dockerfiles/debian-i686-cross.docker | 2 +-
.../dockerfiles/debian-mips64el-cross.docker | 2 +-
.../dockerfiles/debian-mipsel-cross.docker | 2 +-
.../dockerfiles/debian-ppc64el-cross.docker | 2 +-
.../dockerfiles/debian-s390x-cross.docker | 2 +-
tests/docker/dockerfiles/debian.docker | 2 +-
tests/docker/dockerfiles/ubuntu2204.docker | 3 +-
tests/lcitool/mappings.yml | 5 +
tests/lcitool/refresh | 5 +-
46 files changed, 169 insertions(+), 604 deletions(-)
delete mode 100644 rust/qemu-api/src/c_str.rs
delete mode 100644 rust/qemu-api/src/offset_of.rs
delete mode 100644 subprojects/packagefiles/bilge-impl-1.63.0.patch
--
2.49.0