[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/11] rust: qom: fix TODO about zeroability of classes
From: |
Zhao Liu |
Subject: |
Re: [PATCH 07/11] rust: qom: fix TODO about zeroability of classes |
Date: |
Tue, 6 May 2025 16:01:06 +0800 |
On Mon, May 05, 2025 at 11:04:32AM +0200, Paolo Bonzini wrote:
> Date: Mon, 5 May 2025 11:04:32 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 07/11] rust: qom: fix TODO about zeroability of classes
> X-Mailer: git-send-email 2.49.0
>
> The proposed suggestion is not correct. First it is not necessary for
> *all* classes to be Zeroable, only for Rust-defined ones; classes
> defined in C never implement ObjectImpl.
>
> Second, the parent class field need not be Zeroable. For example,
> ChardevClass's chr_write and chr_be_event fields cannot be NULL,
> therefore ChardevClass cannot be Zeroable. However, char_class_init()
> initializes them, therefore ChardevClass could be subclassed by Rust code.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/qemu-api/src/qom.rs | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Yes, it's clearly explained.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
- Re: [PATCH 02/11] meson, cargo: require Rust 1.77.0, (continued)
- [PATCH 04/11] rust: let bilge use "let ... else", Paolo Bonzini, 2025/05/05
- [PATCH 08/11] rust: enable clippy::ptr_cast_constness, Paolo Bonzini, 2025/05/05
- [PATCH 10/11] rust: replace c_str! with c"" literals, Paolo Bonzini, 2025/05/05
- [PATCH 07/11] rust: qom: fix TODO about zeroability of classes, Paolo Bonzini, 2025/05/05
- [PATCH 09/11] rust: remove offset_of replacement, Paolo Bonzini, 2025/05/05
- [PATCH 11/11] docs: rust: update for newer minimum supported version, Paolo Bonzini, 2025/05/05