diff options
| author | bors <bors@rust-lang.org> | 2014-04-01 11:11:51 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-01 11:11:51 -0700 |
| commit | b71c02e512fcfe18ea7a5a8a99ac758b4fa564a6 (patch) | |
| tree | 7842aad2f7ad07256764e22d6ab2fad0b6f624ed /src/libstd/num | |
| parent | b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64 (diff) | |
| parent | bc7a2d72a3fea324fa432de9b6ce6073302d3d8c (diff) | |
| download | rust-b71c02e512fcfe18ea7a5a8a99ac758b4fa564a6.tar.gz rust-b71c02e512fcfe18ea7a5a8a99ac758b4fa564a6.zip | |
auto merge of #13115 : huonw/rust/rand-errors, r=alexcrichton
move errno -> IoError converter into std, bubble up OSRng errors Also adds a general errno -> `~str` converter to `std::os`, and makes the failure messages for the things using `OSRng` (e.g. (transitively) the task-local RNG, meaning hashmap initialisation failures aren't such a black box).
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/strconv.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index dc49da415a4..15c7b251fa7 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -821,31 +821,31 @@ mod bench { #[bench] fn to_str_bin(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<uint>().to_str_radix(2); }) } #[bench] fn to_str_oct(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<uint>().to_str_radix(8); }) } #[bench] fn to_str_dec(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<uint>().to_str_radix(10); }) } #[bench] fn to_str_hex(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<uint>().to_str_radix(16); }) } #[bench] fn to_str_base_36(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<uint>().to_str_radix(36); }) } } @@ -857,31 +857,31 @@ mod bench { #[bench] fn to_str_bin(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<int>().to_str_radix(2); }) } #[bench] fn to_str_oct(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<int>().to_str_radix(8); }) } #[bench] fn to_str_dec(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<int>().to_str_radix(10); }) } #[bench] fn to_str_hex(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<int>().to_str_radix(16); }) } #[bench] fn to_str_base_36(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { rng.gen::<int>().to_str_radix(36); }) } } @@ -893,7 +893,7 @@ mod bench { #[bench] fn float_to_str(bh: &mut BenchHarness) { - let mut rng = XorShiftRng::new(); + let mut rng = XorShiftRng::new().unwrap(); bh.iter(|| { f64::to_str(rng.gen()); }) } } |
