diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-02 18:36:06 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-02 18:36:06 -0600 |
| commit | 8cdfa445d6629ffef4cb84967ff7017654045bc2 (patch) | |
| tree | 22f0b0907c024c78d26a731e2e1f5219407d8102 /vendor/rustix/src/static_assertions.rs | |
| parent | 4351c74c7c5f97156bc94d3a8549b9940ac80e3f (diff) | |
chore: add vendor directory
Diffstat (limited to 'vendor/rustix/src/static_assertions.rs')
| -rw-r--r-- | vendor/rustix/src/static_assertions.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/rustix/src/static_assertions.rs b/vendor/rustix/src/static_assertions.rs new file mode 100644 index 00000000..3d071181 --- /dev/null +++ b/vendor/rustix/src/static_assertions.rs @@ -0,0 +1,36 @@ +//! Workarounds for Rust 1.63 where some things in the `static_assertions` +//! crate do things that don't work in const contexts. We want to call them in +//! const contexts in Rust versions where that's supported so that problems are +//! caught at compile time, and fall back to dynamic asserts in Rust 1.63. + +#![allow(unused_macros)] + +macro_rules! assert_eq_size { + ($x:ty, $y:ty) => { + assert_eq!(core::mem::size_of::<$x>(), core::mem::size_of::<$y>()); + }; +} + +macro_rules! assert_eq_align { + ($x:ty, $y:ty) => { + assert_eq!(core::mem::align_of::<$x>(), core::mem::align_of::<$y>()); + }; +} + +macro_rules! const_assert_eq { + ($x:expr, $y:expr) => { + assert_eq!($x, $y); + }; +} + +macro_rules! const_assert_ne { + ($x:expr, $y:expr) => { + assert_ne!($x, $y); + }; +} + +macro_rules! const_assert { + ($x:expr) => { + assert!($x); + }; +} |
