]> www.infradead.org Git - users/hch/misc.git/commit
rust: static_assert: add optional message
authorAltan Ozlu <altan@ozlu.eu>
Wed, 26 Mar 2025 20:25:36 +0000 (20:25 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 11 May 2025 22:20:25 +0000 (00:20 +0200)
commit0fa5f8c877cae959de7cf6c3dc054e23e7ebcd75
treed9ace5e049901df60b77e4b2ed560106f60950bb
parent79d04e73ba481f8537691095cdd2cfd3acdb9c80
rust: static_assert: add optional message

Add an optional panic message to the `static_assert!` macro.

The panic message doesn't support argument formatting, because the
`assert!` macro only supports formatting in non-const contexts.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1149
Signed-off-by: Altan Ozlu <altan@ozlu.eu>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Link: https://lore.kernel.org/r/20250326202520.1176162-2-altan@ozlu.eu
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/static_assert.rs