about summary refs log tree commit diff
path: root/src/librand
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-03-24 15:45:11 -0400
committerNiko Matsakis <niko@alum.mit.edu>2015-03-30 05:02:20 -0400
commitc92bdcb232da3973a8a548e6b2044b610e286210 (patch)
treeb41dd1d636f8565c1cbc00ed775858b1cf9b628d /src/librand
parentd6466ff13aef6af45f24f28e23f2f3dd36c96cf0 (diff)
downloadrust-c92bdcb232da3973a8a548e6b2044b610e286210.tar.gz
rust-c92bdcb232da3973a8a548e6b2044b610e286210.zip
Fallout where types must be specified.
This is due to a [breaking-change] to operators. The primary affected
code is uses of the `Rng` trait where we used to (incorrectly) infer the
right-hand-side type from the left-hand-side, in the case that the LHS
type was a scalar like `i32`. The fix is to add a type annotation like
`x + rng.gen::<i32>()`.
Diffstat (limited to 'src/librand')
-rw-r--r--src/librand/distributions/mod.rs2
-rw-r--r--src/librand/distributions/range.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs
index cb0829f5245..62189e721e5 100644
--- a/src/librand/distributions/mod.rs
+++ b/src/librand/distributions/mod.rs
@@ -256,7 +256,7 @@ fn ziggurat<R: Rng, P, Z>(
             return zero_case(rng, u);
         }
         // algebraically equivalent to f1 + DRanU()*(f0 - f1) < 1
-        if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen() < pdf(x) {
+        if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen::<f64>() < pdf(x) {
             return x;
         }
     }
diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs
index 0f74e67f5a7..347d494259d 100644
--- a/src/librand/distributions/range.rs
+++ b/src/librand/distributions/range.rs
@@ -154,7 +154,7 @@ macro_rules! float_impl {
                 }
             }
             fn sample_range<R: Rng>(r: &Range<$ty>, rng: &mut R) -> $ty {
-                r.low + r.range * rng.gen()
+                r.low + r.range * rng.gen::<$ty>()
             }
         }
     }