summaryrefslogtreecommitdiff
path: root/rust/kernel/static_assert.rs
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@kernel.org>2026-05-18 11:01:07 +0200
committerThomas Gleixner <tglx@kernel.org>2026-05-18 11:01:07 +0200
commit09d6818d3bdc1ea6e49a425040528cbdbc97bc0a (patch)
tree989f9d94c592294e4ae5421c9cbcbad99eee996c /rust/kernel/static_assert.rs
parent1655f6895a896eb632ca8a019259bc5d358a9712 (diff)
parent5200f5f493f79f14bbdc349e402a40dfb32f23c8 (diff)
Merge branch 'linus' into timers/clocksource
... to bring it up to date for new changes.
Diffstat (limited to 'rust/kernel/static_assert.rs')
-rw-r--r--rust/kernel/static_assert.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/rust/kernel/static_assert.rs b/rust/kernel/static_assert.rs
deleted file mode 100644
index a57ba14315a0..000000000000
--- a/rust/kernel/static_assert.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-//! Static assert.
-
-/// Static assert (i.e. compile-time assert).
-///
-/// Similar to C11 [`_Static_assert`] and C++11 [`static_assert`].
-///
-/// An optional panic message can be supplied after the expression.
-/// Currently only a string literal without formatting is supported
-/// due to constness limitations of the [`assert!`] macro.
-///
-/// The feature may be added to Rust in the future: see [RFC 2790].
-///
-/// [`_Static_assert`]: https://en.cppreference.com/w/c/language/_Static_assert
-/// [`static_assert`]: https://en.cppreference.com/w/cpp/language/static_assert
-/// [RFC 2790]: https://github.com/rust-lang/rfcs/issues/2790
-///
-/// # Examples
-///
-/// ```
-/// static_assert!(42 > 24);
-/// static_assert!(core::mem::size_of::<u8>() == 1);
-///
-/// const X: &[u8] = b"bar";
-/// static_assert!(X[1] == b'a');
-///
-/// const fn f(x: i32) -> i32 {
-/// x + 2
-/// }
-/// static_assert!(f(40) == 42);
-/// static_assert!(f(40) == 42, "f(x) must add 2 to the given input.");
-/// ```
-#[macro_export]
-macro_rules! static_assert {
- ($condition:expr $(,$arg:literal)?) => {
- const _: () = ::core::assert!($condition $(,$arg)?);
- };
-}