As explained for v1, the impetus for this series is to remove BqlCell<> from HPETState::num_timers. However, it's also an important step for QAPI: error propagation is pretty central for example to QMP, and the series is also a first example of two-way conversion between C and native-Rust structs (i.e. not using bindgen-generated structs or their opaque wrappers).
As an aside, support for NUL-terminated file is now scheduled for inclusion in Rust as "panic::Location::file_with_nul()", but it will be quite a while before QEMU can use it. For more information, see https://github.com/rust-lang/rust/issues/141727. Paolo v1->v2: - patch "rust: make declaration of dependent crates more consistent" merged - change dependency name for anyhow to anyhow-1-rs - update scripts/archive-source.sh and scripts/make-release [Zhao] - update foreign to 0.3.1 instead of 0.2.0 - use %.*s to print non-NUL-terminated err->src [Markus] - make err->src_len an int instead of a size_t [Markus] - add doc comment for error module - remove #[derive(Default)] for Error [Markus] - rewrite ok_or_propagate in functional style [Markus] - clarify "validity" of Error** [Markus] - clarify that err_or_unit/err_or_else free the Error* [Markus] new patches: - hpet: adjust VMState for consistency with Rust version [Zhao] - rust: qemu-api: add tests for Error bindings - docs: update Rust module status Paolo Bonzini (13): subprojects: add the anyhow crate subprojects: add the foreign crate util/error: expose Error definition to Rust code util/error: allow non-NUL-terminated err->src util/error: make func optional rust: qemu-api: add bindings to Error rust: qemu-api: add tests for Error bindings rust: qdev: support returning errors from realize rust/hpet: change type of num_timers to usize hpet: adjust VMState for consistency with Rust version hpet: return errors from realize if properties are incorrect rust/hpet: return errors from realize if properties are incorrect docs: update Rust module status Zhao Liu (1): rust/hpet: Drop BqlCell wrapper for num_timers docs/devel/rust.rst | 2 +- include/qapi/error-internal.h | 27 ++ rust/wrapper.h | 1 + hw/timer/hpet.c | 21 +- util/error.c | 20 +- rust/Cargo.lock | 17 + rust/Cargo.toml | 1 + rust/hw/char/pl011/src/device.rs | 5 +- rust/hw/timer/hpet/src/device.rs | 62 ++- rust/hw/timer/hpet/src/fw_cfg.rs | 7 +- rust/meson.build | 4 + rust/qemu-api/Cargo.toml | 2 + rust/qemu-api/meson.build | 3 +- rust/qemu-api/src/error.rs | 403 ++++++++++++++++++ rust/qemu-api/src/lib.rs | 3 + rust/qemu-api/src/qdev.rs | 10 +- scripts/archive-source.sh | 5 +- scripts/make-release | 5 +- subprojects/.gitignore | 2 + subprojects/anyhow-1-rs.wrap | 7 + subprojects/foreign-0.3-rs.wrap | 7 + .../packagefiles/anyhow-1.0-rs/meson.build | 33 ++ .../packagefiles/foreign-0.3-rs/meson.build | 26 ++ 23 files changed, 602 insertions(+), 71 deletions(-) create mode 100644 include/qapi/error-internal.h create mode 100644 rust/qemu-api/src/error.rs create mode 100644 subprojects/anyhow-1-rs.wrap create mode 100644 subprojects/foreign-0.3-rs.wrap create mode 100644 subprojects/packagefiles/anyhow-1.0-rs/meson.build create mode 100644 subprojects/packagefiles/foreign-0.3-rs/meson.build -- 2.49.0