Skip to content

Commit 8dec2f5

Browse files
authored
Fix issue with exported macro (#69)
1 parent 4bedd6e commit 8dec2f5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gridiron"
3-
version = "0.12.1"
3+
version = "0.12.2"
44
edition = "2024"
55
authors = ["IronCore Labs <code at ironcorelabs.com>"]
66
repository = "https://github.com/IronCoreLabs/gridiron"

src/digits/util.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ pub fn split_u128_to_62b(i: u128) -> (u64, u64) {
176176
((i >> 62) as u64, (i & 0x3FFFFFFFFFFFFFFF) as u64)
177177
}
178178

179+
/// WARNING: This macro is always exported, but will generate code that depends on proptest. Don't call it
180+
/// in a location where that won't compile.
181+
///
179182
/// Shared proptest strategy for generating arbitrary field elements with edge case coverage.
180183
///
181184
/// This macro generates an `arb_fp` function that produces field elements with:
@@ -190,7 +193,11 @@ pub fn split_u128_to_62b(i: u128) -> (u64, u64) {
190193
/// - `$limbsizebits`: Bits per limb (31 or 62)
191194
/// - `$limbtype`: Limb type (`u32` or `u64`)
192195
/// - `$limb_mask`: Mask for valid limb bits (`0x7FFFFFFFu32` or `0x3FFFFFFFFFFFFFFFu64`)
193-
#[cfg(test)]
196+
///
197+
/// Note: This macro must NOT be gated by `#[cfg(test)]` because it's referenced via
198+
/// `$crate::define_arb_fp!` from within the `fp31!`/`fp62!` macros' test modules.
199+
/// When a downstream crate runs tests, `$crate` refers to gridiron compiled as a
200+
/// dependency (not in test mode), so the macro must always be exported.
194201
#[macro_export]
195202
macro_rules! define_arb_fp {
196203
($classname:ident, $limbsizebits:expr, $limbtype:ty, $limb_mask:expr) => {

0 commit comments

Comments
 (0)