diff --git a/Cargo.toml b/Cargo.toml index 33322a04..062adc6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,10 @@ exclude = [".*"] # use std to retrieve OS error descriptions std = [] +# Use the custom backend on unsupported targets +# WARNING: this feature SHOULD be enabled only by fallback implementation crates! +custom-fallback = [] + # Optional backend: wasm_js # This flag enables the backend but does not select it. To use the backend, use # this flag *and* set getrandom_backend=wasm_js (see README). diff --git a/src/backends.rs b/src/backends.rs index d7b73cec..dbd22e05 100644 --- a/src/backends.rs +++ b/src/backends.rs @@ -182,6 +182,9 @@ cfg_if! { } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] { mod rdrand; pub use rdrand::*; + } else if #[cfg(feature = "custom-fallback")] { + mod custom; + pub use custom::*; } else if #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] { compile_error!(concat!( "The wasm32-unknown-unknown targets are not supported by default; \