From 04b49df7432259ed48a79e3c8e5f64031ef7c095 Mon Sep 17 00:00:00 2001 From: Casper Date: Fri, 3 Mar 2023 23:34:59 +0100 Subject: [PATCH] Force random const eval (#51) --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bde500d..2b639c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -81,8 +81,9 @@ pub mod xref; #[macro_export] macro_rules! random { ($ty:ident $(, $seeds:expr)* $(,)?) => {{ - const _RANDOM_ENTROPY: u64 = $crate::entropy(concat!(file!(), ":", line!(), ":", column!() $(, ":", $seeds)*)); - $crate::__random_cast!($ty, _RANDOM_ENTROPY) + const _ENTROPY: u64 = $crate::entropy(concat!(file!(), ":", line!(), ":", column!() $(, ":", $seeds)*)); + const _RANDOM: $ty = $crate::__random_cast!($ty, _ENTROPY); + _RANDOM }}; }