Skip to content

Commit fe5baaa

Browse files
committed
Add new macros for static assertions and extend feature list in core_arch
1 parent 0ea7bce commit fe5baaa

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

library/stdarch/crates/core_arch/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
x86_amx_intrinsics,
3636
f16,
3737
aarch64_unstable_target_feature,
38-
bigint_helper_methods
38+
bigint_helper_methods,
39+
adt_const_params,
40+
unchecked_shifts,
41+
portable_simd
3942
)]
4043
#![cfg_attr(test, feature(test, abi_vectorcall, stdarch_internal))]
4144
#![deny(clippy::missing_inline_in_public_items)]

library/stdarch/crates/core_arch/src/macros.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ macro_rules! static_assert_simm_bits {
4848
};
4949
}
5050

51+
#[allow(unused_macros)]
52+
macro_rules! static_assert_range {
53+
($imm:ident, $min:expr, $max:expr) => {
54+
static_assert!(
55+
$min <= $imm && $imm <= $max,
56+
concat!(
57+
stringify!($imm),
58+
" is not in the range [",
59+
stringify!($min),
60+
", ",
61+
stringify!($max),
62+
"]",
63+
)
64+
)
65+
};
66+
}
67+
5168
#[allow(unused)]
5269
macro_rules! types {
5370
(

0 commit comments

Comments
 (0)