Re: [PATCH v4] rust: kernel: introduce `unsafe_precondition_assert!` macro
From: Ritvik Gupta
Date: Mon Aug 11 2025 - 07:40:37 EST
> > + ($cond:expr, $($arg:tt)+) => {
> > + $crate::unsafe_precondition_assert!(@inner $cond, ::core::format_args!($($arg)+))
>
> Tamir, taking your fmt series into account, what's the correct
> replacement for ::core::format_args! here?
Whoops! I wasn't aware of the fmt-series! Thanks for mentioning it :)
After a quick search, `kernel::prelude::fmt!` type/macro [1,2] seems to be the relevant replacement.
So, the line would look like:
`$crate::unsafe_precondition_assert!(@inner $cond, $crate::prelude::fmt!($($arg)+))`
Does that sound right?
[1]: https://github.com/Rust-for-Linux/linux/blob/8f5ae30d69d7543eee0d70083daf4de8fe15d585/rust/kernel/prelude.rs#L36
[2]: https://lore.kernel.org/rust-for-linux/20250719-core-cstr-fanout-1-v2-4-1ab5ba189c6e@xxxxxxxxx/