File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
branches/try/src/libstd/rand Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5
- refs/heads/try: 618c6afe3232d0cc3750178d4f301352684ddde6
5
+ refs/heads/try: 62fededd8e9cfd85197f224123a057df43a6feab
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Original file line number Diff line number Diff line change @@ -363,6 +363,12 @@ impl Isaac64Rng {
363
363
}
364
364
365
365
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
+
366
372
#[ inline]
367
373
fn next_u64 ( & mut self ) -> u64 {
368
374
if self . cnt == 0 {
Original file line number Diff line number Diff line change @@ -99,12 +99,8 @@ pub trait Rng {
99
99
/// Return the next random u32. This rarely needs to be called
100
100
/// directly, prefer `r.gen()` to `r.next_u32()`.
101
101
///
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 ;
108
104
109
105
/// Return the next random u64. This rarely needs to be called
110
106
/// directly, prefer `r.gen()` to `r.next_u64()`.
Original file line number Diff line number Diff line change @@ -209,6 +209,9 @@ mod tests {
209
209
use rand:: Rng ;
210
210
struct ConstantRng ( u64 ) ;
211
211
impl Rng for ConstantRng {
212
+ fn next_u32 ( & mut self ) -> u32 {
213
+ ( * * self ) as u32
214
+ }
212
215
fn next_u64 ( & mut self ) -> u64 {
213
216
* * self
214
217
}
You can’t perform that action at this time.
0 commit comments