[PATCH 0/9] rust: allow minimum version of 1.77

Paolo Bonzini posted 9 patches 6 months, 2 weeks ago
Failed in applying to current master (apply log)
There is a newer version of this series
docs/about/build-platforms.rst                |   7 +-
docs/devel/rust.rst                           |  38 +---
rust/Cargo.lock                               |   1 -
rust/Cargo.toml                               |   4 +-
rust/clippy.toml                              |   2 +-
rust/hw/char/pl011/Cargo.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/Cargo.toml                 |   2 +-
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/Cargo.toml               |   2 +-
rust/qemu-api-macros/src/lib.rs               | 113 +++++-------
rust/qemu-api/Cargo.toml                      |   5 +-
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                      |   7 +-
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 +--
subprojects/bilge-impl-0.2-rs.wrap            |   2 -
.../packagefiles/bilge-impl-1.63.0.patch      |  45 -----
tests/lcitool/mappings.yml                    |   3 +
35 files changed, 146 insertions(+), 585 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
[PATCH 0/9] rust: allow minimum version of 1.77
Posted by Paolo Bonzini 6 months, 2 weeks ago
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

Paolo Bonzini (9):
  lcitool: use Rust 1.78 for Debian bookworm
  rust: use std::ffi instead of std::os::raw
  rust: let bilge use "let ... else"
  rust: qemu_api_macros: use "let ... else"
  rust: use MaybeUninit::zeroed() in const context
  rust: remove offset_of replacement
  rust: replace c_str! with c"" literals
  rust: enable clippy::ptr_cast_constness
  docs: rust: update for newer minimum supported version

 docs/about/build-platforms.rst                |   7 +-
 docs/devel/rust.rst                           |  38 +---
 rust/Cargo.lock                               |   1 -
 rust/Cargo.toml                               |   4 +-
 rust/clippy.toml                              |   2 +-
 rust/hw/char/pl011/Cargo.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/Cargo.toml                 |   2 +-
 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/Cargo.toml               |   2 +-
 rust/qemu-api-macros/src/lib.rs               | 113 +++++-------
 rust/qemu-api/Cargo.toml                      |   5 +-
 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                      |   7 +-
 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 +--
 subprojects/bilge-impl-0.2-rs.wrap            |   2 -
 .../packagefiles/bilge-impl-1.63.0.patch      |  45 -----
 tests/lcitool/mappings.yml                    |   3 +
 35 files changed, 146 insertions(+), 585 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
Re: [PATCH 0/9] rust: allow minimum version of 1.77
Posted by Manos Pitsidianakis 6 months, 2 weeks ago
Hey Paolo,

We should update the version check in the root meson.build in the first 
patch of this series:

> if have_rust
>   rustc = meson.get_compiler('rust')
>   if rustc.version().version_compare('<1.63.0')
>     if get_option('rust').enabled()
>       error('rustc version ' + rustc.version() + ' is unsupported. Please upgrade to at least 1.63.0')
>     else
>       warning('rustc version ' + rustc.version() + ' is unsupported, disabling Rust compilation.')
>       message('Please upgrade to at least 1.63.0 to use Rust.')
>       have_rust = false
>     endif
>   endif
> endif