From 7f1f62a1bf818a3b63fe6d7622b58a72f3dc9171 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 25 May 2022 12:09:01 -0400 Subject: [PATCH 1/2] Implement static_assert! in a more idiomatic way --- rust/kernel/static_assert.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rust/kernel/static_assert.rs b/rust/kernel/static_assert.rs index c4424218b0ce4a..7f1370f7423c6d 100644 --- a/rust/kernel/static_assert.rs +++ b/rust/kernel/static_assert.rs @@ -29,10 +29,6 @@ #[macro_export] macro_rules! static_assert { ($condition:expr) => { - // Based on the latest one in `rustc`'s one before it was [removed]. - // - // [removed]: https://github.com/rust-lang/rust/commit/c2dad1c6b9f9636198d7c561b47a2974f5103f6d - #[allow(dead_code)] - const _: () = [()][!($condition) as usize]; + const _: () = assert!($condition); }; } From c59939b2501521124876ded26ecd1424ab8c8db3 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 25 May 2022 12:33:18 -0400 Subject: [PATCH 2/2] Update static_assert.rs --- rust/kernel/static_assert.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/static_assert.rs b/rust/kernel/static_assert.rs index 7f1370f7423c6d..3115ee0ba8e9d7 100644 --- a/rust/kernel/static_assert.rs +++ b/rust/kernel/static_assert.rs @@ -29,6 +29,6 @@ #[macro_export] macro_rules! static_assert { ($condition:expr) => { - const _: () = assert!($condition); + const _: () = core::assert!($condition); }; }