diff --git a/Cargo.toml b/Cargo.toml index a938c207..88a08189 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,6 @@ wasm-bindgen-test = "0.2" [features] std = [] -# Enables dummy implementation for unsupported targets -dummy = [] # Unstable feature to support being a libstd dependency rustc-dep-of-std = ["compiler_builtins", "core"] # Unstable feature for testing diff --git a/README.md b/README.md index 01bbfb5e..e2a3b681 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,6 @@ a compilation error. If you want to build an application which uses `getrandom` for such target, you can either: - Use [`[replace]`][replace] or [`[patch]`][patch] section in your `Cargo.toml` to switch to a custom implementation with a support of your target. -- Enable the `dummy` feature to have getrandom use an implementation that always -fails at run-time on unsupported targets. [replace]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-replace-section [patch]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section diff --git a/src/dummy.rs b/src/dummy.rs deleted file mode 100644 index 0c24ba0f..00000000 --- a/src/dummy.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A dummy implementation for unsupported targets which always fails -use crate::{error::UNSUPPORTED, Error}; - -pub fn getrandom_inner(_: &mut [u8]) -> Result<(), Error> { - Err(UNSUPPORTED) -} diff --git a/src/lib.rs b/src/lib.rs index 594e59d4..666d2bc9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,8 +43,6 @@ //! for such target, you can either: //! - Use [`[replace]`][replace] or [`[patch]`][patch] section in your `Cargo.toml` //! to switch to a custom implementation with a support of your target. -//! - Enable the `dummy` feature to have getrandom use an implementation that always -//! fails at run-time on unsupported targets. //! //! [replace]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-replace-section //! [patch]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section @@ -239,13 +237,12 @@ cfg_if! { } else if #[cfg(feature = "stdweb")] { #[path = "wasm32_stdweb.rs"] mod imp; } else { - // Always have an implementation for wasm32-unknown-unknown. - // See https://github.com/rust-random/getrandom/issues/87 - #[path = "dummy.rs"] mod imp; + compile_error!("\ + Enable crate features to use the wasm32-unknown-unknown target, see: \ + https://docs.rs/getrandom/#support-for-webassembly-and-asmjs\ + "); } } - } else if #[cfg(feature = "dummy")] { - #[path = "dummy.rs"] mod imp; } else { compile_error!("\ target is not supported, for more information see: \