diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index f02b945178f..12dbbfdb0ed 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -10,6 +10,7 @@ //! The exponential distribution. +#[cfg(not(test))] // only necessary for no_std use FloatMath; use {Rng, Rand}; diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 8cd7ac06f99..cf488236560 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -13,6 +13,7 @@ use self::GammaRepr::*; use self::ChiSquaredRepr::*; +#[cfg(not(test))] // only necessary for no_std use FloatMath; use {Rng, Open01}; diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index a54c8df2352..2557d39c550 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -17,7 +17,9 @@ //! internally. The `IndependentSample` trait is for generating values //! that do not need to record state. +#[cfg(not(test))] // only necessary for no_std use core::num::Float; + use core::marker::PhantomData; use {Rng, Rand}; diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index b2ccc5eb609..86840c568e0 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -10,6 +10,7 @@ //! The normal and derived distributions. +#[cfg(not(test))] // only necessary for no_std use FloatMath; use {Rng, Rand, Open01}; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index e651f5bc182..d8517fb4c57 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -28,13 +28,13 @@ #![unstable(feature = "rand", reason = "use `rand` from crates.io", issue = "27703")] -#![feature(core_float)] #![feature(core_intrinsics)] #![feature(staged_api)] #![feature(step_by)] #![feature(custom_attribute)] #![allow(unused_attributes)] +#![cfg_attr(not(test), feature(core_float))] // only necessary for no_std #![cfg_attr(test, feature(test, rand))] #![allow(deprecated)]