Message ID | 20241021163538.136941-1-pbonzini@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | rust: miscellaneous cleanups + QOM integration tests | expand |
Am 21.10.2024 um 18:35 hat Paolo Bonzini geschrieben: > This series integrates some of the observations from the MSRV patches at > https://lore.kernel.org/qemu-devel/20241015131735.518771-1-pbonzini@redhat.com/. > > The main changes here are two: first, build an integration test that > actually tries to create a QOM object that is defined by Rust code; > second, make the properties array immutable so that declare_properties! > is enforced to use only const-friendly constructs. These are patches > 6-11; the others consist of small cleanups. > > Hidden in here is actually a C patch (#10) which makes the > bindgen-generated prototypes use "*const" instead of "*mut". > > Tested with Rust nightly and (together with more patches from the > RFC), with Rust 1.63.0. > > Unlike the MSRV patches, this should be ready for inclusion; the > changes should be mostly uncontroversial. I'm not convinced that Zeroable has sufficient justification when all it does is saving us a few lines of code at the expense of making things more implicit. But it's used correctly as far as I can tell, so: Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Il mar 22 ott 2024, 22:46 Kevin Wolf <kwolf@redhat.com> ha scritto: > Am 21.10.2024 um 18:35 hat Paolo Bonzini geschrieben: > > This series integrates some of the observations from the MSRV patches at > > > https://lore.kernel.org/qemu-devel/20241015131735.518771-1-pbonzini@redhat.com/ > . > > > > The main changes here are two: first, build an integration test that > > actually tries to create a QOM object that is defined by Rust code; > > second, make the properties array immutable so that declare_properties! > > is enforced to use only const-friendly constructs. These are patches > > 6-11; the others consist of small cleanups. > > > > Hidden in here is actually a C patch (#10) which makes the > > bindgen-generated prototypes use "*const" instead of "*mut". > > > > Tested with Rust nightly and (together with more patches from the > > RFC), with Rust 1.63.0. > > > > Unlike the MSRV patches, this should be ready for inclusion; the > > changes should be mostly uncontroversial. > > I'm not convinced that Zeroable has sufficient justification when all it > does is saving us a few lines of code at the expense of making things > more implicit Implicit zero fields are used a lot in C code, including in VMStateDescription and various const vtable structs, so I think we need something of equivalent brevity. There could be other solutions, for example a more generic ConstDefault::DEFAULT trait. For now I went for something that resembles existing code, as well as the C code we're converting. . But it's used correctly as far as I can tell, so: > > Reviewed-by: Kevin Wolf <kwolf@redhat.com> > Thanks! Paolo >