diff --git a/distributions/mod.rs b/distributions/mod.rs index 89c8e90f2c3..06bd04814c0 100644 --- a/distributions/mod.rs +++ b/distributions/mod.rs @@ -129,7 +129,7 @@ impl<'a, T: Clone> WeightedChoice<'a, T> { for item in items.iter_mut() { running_total = match running_total.checked_add(&item.weight) { Some(n) => n, - None => fail!("WeightedChoice::new called with a total weight \ + None => panic!("WeightedChoice::new called with a total weight \ larger than a uint can contain") }; diff --git a/lib.rs b/lib.rs index ebaa0349f5b..405b70492a3 100644 --- a/lib.rs +++ b/lib.rs @@ -92,7 +92,7 @@ pub trait Rng { /// not be relied upon. /// /// This method should guarantee that `dest` is entirely filled - /// with new data, and may fail if this is impossible + /// with new data, and may panic if this is impossible /// (e.g. reading past the end of a file that is being used as the /// source of randomness). /// @@ -375,7 +375,7 @@ impl Rng for XorShiftRng { } impl SeedableRng<[u32, .. 4]> for XorShiftRng { - /// Reseed an XorShiftRng. This will fail if `seed` is entirely 0. + /// Reseed an XorShiftRng. This will panic if `seed` is entirely 0. fn reseed(&mut self, seed: [u32, .. 4]) { assert!(!seed.iter().all(|&x| x == 0), "XorShiftRng.reseed called with an all zero seed."); @@ -386,7 +386,7 @@ impl SeedableRng<[u32, .. 4]> for XorShiftRng { self.w = seed[3]; } - /// Create a new XorShiftRng. This will fail if `seed` is entirely 0. + /// Create a new XorShiftRng. This will panic if `seed` is entirely 0. fn from_seed(seed: [u32, .. 4]) -> XorShiftRng { assert!(!seed.iter().all(|&x| x == 0), "XorShiftRng::from_seed called with an all zero seed."); @@ -446,7 +446,7 @@ pub struct Closed01(pub F); #[cfg(not(test))] mod std { - pub use core::{option, fmt}; // fail!() + pub use core::{option, fmt}; // panic!() } #[cfg(test)]