Skip to content

Commit 95de572

Browse files
committed
---
yaml --- r: 82250 b: refs/heads/master c: 62feded h: refs/heads/master v: v3
1 parent 58a87d9 commit 95de572

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 618c6afe3232d0cc3750178d4f301352684ddde6
2+
refs/heads/master: 62fededd8e9cfd85197f224123a057df43a6feab
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729

trunk/src/libstd/rand/isaac.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,12 @@ impl Isaac64Rng {
363363
}
364364

365365
impl Rng for Isaac64Rng {
366+
// FIXME #7771: having next_u32 like this should be unnecessary
367+
#[inline]
368+
fn next_u32(&mut self) -> u32 {
369+
self.next_u64() as u32
370+
}
371+
366372
#[inline]
367373
fn next_u64(&mut self) -> u64 {
368374
if self.cnt == 0 {

trunk/src/libstd/rand/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,8 @@ pub trait Rng {
9999
/// Return the next random u32. This rarely needs to be called
100100
/// directly, prefer `r.gen()` to `r.next_u32()`.
101101
///
102-
/// By default this is implemented in terms of `next_u64`. An
103-
/// implementation of this trait must provide at least one of
104-
/// these two methods.
105-
fn next_u32(&mut self) -> u32 {
106-
self.next_u64() as u32
107-
}
102+
// FIXME #7771: Should be implemented in terms of next_u64
103+
fn next_u32(&mut self) -> u32;
108104

109105
/// Return the next random u64. This rarely needs to be called
110106
/// directly, prefer `r.gen()` to `r.next_u64()`.

trunk/src/libstd/rand/rand_impls.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ mod tests {
209209
use rand::Rng;
210210
struct ConstantRng(u64);
211211
impl Rng for ConstantRng {
212+
fn next_u32(&mut self) -> u32 {
213+
(**self) as u32
214+
}
212215
fn next_u64(&mut self) -> u64 {
213216
**self
214217
}

0 commit comments

Comments
 (0)