rust: fix doctests
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 11 Feb 2025 12:55:53 +0000 (13:55 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 13 Feb 2025 12:50:43 +0000 (13:50 +0100)
Doctests were not being run by CI, and have broken. Fix them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
.gitlab-ci.d/buildtest.yml
rust/qemu-api/src/vmstate.rs
rust/qemu-api/src/zeroable.rs

index 4265a57783430c84074e3718faa2179793f1d239..00f4bfcd9f355f548f9b49600ef822e7090d2232 100644 (file)
@@ -131,6 +131,12 @@ build-system-fedora-rust-nightly:
     CONFIGURE_ARGS: --disable-docs --enable-rust --enable-strict-rust-lints
     TARGETS: aarch64-softmmu
     MAKE_CHECK_ARGS: check-build
+  after_script:
+    - source scripts/ci/gitlab-ci-section
+    - section_start test "Running Rust doctests"
+    - cd build
+    - pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} test --doc -p qemu_api
+
   allow_failure: true
 
 check-system-fedora:
index c6dfb6093568ea3b277bef29f327a6310959eca0..24a4dc81e7fd66294a8fb4afb6e6b1d44ca4ed0e 100644 (file)
@@ -294,7 +294,7 @@ impl VMStateField {
 /// # Examples
 ///
 /// ```
-/// # use qemu_api::vmstate::impl_vmstate_forward;
+/// # use qemu_api::impl_vmstate_forward;
 /// pub struct Fifo([u8; 16]);
 /// impl_vmstate_forward!(Fifo);
 /// ```
index a2356cb2f24cbed520cc41a56c06d816c47d291c..47b6977828da5ffc00fbedd87519cec2d9049c17 100644 (file)
@@ -7,7 +7,7 @@
 /// behavior.  This trait in principle could be implemented as just:
 ///
 /// ```
-/// pub unsafe trait Zeroable {
+/// pub unsafe trait Zeroable: Default {
 ///     const ZERO: Self = unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() };
 /// }
 /// ```