> +#[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] =
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 ---