Skip to content

Commit

Permalink
add a more descriptive compile error when no rng source is available …
Browse files Browse the repository at this point in the history
…on wasm
  • Loading branch information
KodrAus committed Feb 14, 2025
1 parent 5421417 commit 920e8b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rng.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code)] // Keeps our cfg's from becoming too convoluted in here
#![allow(dead_code, unused_imports)] // Keeps our cfg's from becoming too convoluted in here

trait Rng {
fn u128() -> u128;
Expand Down Expand Up @@ -100,8 +100,13 @@ mod imp {
Random support for `wasm32-unknown-unknown`.
*/

#![allow(dead_code, unused_imports)] // Keeps our cfg's from becoming too convoluted in here

use super::*;

#[cfg(all(not(feature = "js"), not(feature = "rng-getrandom"), not(feature = "rng-rand")))]
compile_error!("to use `uuid` on `wasm32-unknown-unknown`, specify a source of randomness using one of the `js`, `rng-getrandom`, or `rng-rand` features");

// Using `rand`
#[cfg(feature = "rng-rand")]
pub(super) struct RngImp;
Expand Down

0 comments on commit 920e8b1

Please sign in to comment.