Re: [PATCH 11/23] rust: introduce a c_str macro

2024-10-31 Thread Zhao Liu
> +#[macro_export] > +/// Given a string constant _without_ embedded or trailing NULs, return > +/// a CStr. > +/// > +/// Needed for compatibility with Rust <1.77. > +macro_rules! c_str { > +($str:expr) => {{ > +const STRING: &str = concat!($str, "\0"); > +const BYTES: &[u8] =

[PATCH 11/23] rust: introduce a c_str macro

2024-10-25 Thread Paolo Bonzini
This allows CStr constants to be defined easily on Rust 1.63.0, while checking that there are no embedded NULs. c"" literals were only stabilized in Rust 1.77.0. Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/src/device.rs | 5 ++- rust/hw/char/pl011/src/device_class.rs | 18 ---