Re: [PATCH 3/3] rust: pl011: Check size of state struct at compile time

2025-04-05 Thread Peter Maydell
On Thu, 20 Mar 2025 at 15:25, Zhao Liu wrote: > > > -use std::{ffi::CStr, ptr::addr_of_mut}; > > +use std::{ffi::CStr, mem, ptr::addr_of_mut}; > > maybe mem::size_of (since there're 2 use cases :-))? > > > > > use qemu_api::{ > > +bindings, > > chardev::{CharBackend, Chardev, Event}, > >

Re: [PATCH 3/3] rust: pl011: Check size of state struct at compile time

2025-04-04 Thread Zhao Liu
> > > +// Some C users of this device embed its state struct into their own > > > +// structs, so the size of the Rust version must not be any larger > > > +// than the size of the C one. If this assert triggers you need to > > > +// expand the padding_for_rust[] array in the C PL011State struct. >

Re: [PATCH 3/3] rust: pl011: Check size of state struct at compile time

2025-03-20 Thread Zhao Liu
> -use std::{ffi::CStr, ptr::addr_of_mut}; > +use std::{ffi::CStr, mem, ptr::addr_of_mut}; maybe mem::size_of (since there're 2 use cases :-))? > > use qemu_api::{ > +bindings, > chardev::{CharBackend, Chardev, Event}, > +static_assert, This one looks like it breaks the alphabet