Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static_assert! optional message #1149

Open
ojeda opened this issue Mar 22, 2025 · 3 comments
Open

static_assert! optional message #1149

ojeda opened this issue Mar 22, 2025 · 3 comments
Labels
easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library.

Comments

@ojeda
Copy link
Member

ojeda commented Mar 22, 2025

The static_assert! macro could support an optional message.

Lore: https://lore.kernel.org/rust-for-linux/CANiq72=QN3Sr5xS-uFhZVX0+L2==moR7cBzRJ8kKxDa5s75-jw@mail.gmail.com/


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag, and a Link: tag to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details."

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@ojeda ojeda added easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library. labels Mar 22, 2025
@altanozlu
Copy link

Hello Miguel, I would like to work on this issue.

@ojeda
Copy link
Member Author

ojeda commented Mar 23, 2025

Please feel free to go ahead -- thanks!

@altanozlu
Copy link

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Mar 24, 2025
Add optional panic message for `static_assert!` macro.

It doesn't support argument formatting, due to `const_format_args`
being experimental. It will fail to compile if a message with argument
is given.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1149
Signed-off-by: Altan Ozlu <altan@ozlu.eu>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Mar 24, 2025
Add optional panic message for `static_assert!` macro.

It doesn't support argument formatting, due to `const_format_args`
being experimental. It will fail to compile if a message with argument
is given.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1149
Signed-off-by: Altan Ozlu <altan@ozlu.eu>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Mar 25, 2025
Add an optional panic message for `static_assert!` macro.

It doesn't support argument formatting, because currently `assert!`
doesn't allow formatting in const contextes.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1149
Signed-off-by: Altan Ozlu <altan@ozlu.eu>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Mar 26, 2025
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: Rust-for-Linux#1149
Signed-off-by: Altan Ozlu <altan@ozlu.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library.
Development

No branches or pull requests

2 participants