@@ -739,27 +739,4 @@ mod sealed {
739
739
740
740
#[ cfg( test) ]
741
741
#[ allow( dead_code) ] // Not used in all configurations.
742
- pub ( crate ) mod test_helpers {
743
- /// Test-only replacement for `rand::thread_rng()`, which is unusable for
744
- /// us, as we want to allow running stdlib tests on tier-3 targets which may
745
- /// not have `getrandom` support.
746
- ///
747
- /// Does a bit of a song and dance to ensure that the seed is different on
748
- /// each call (as some tests sadly rely on this), but doesn't try that hard.
749
- ///
750
- /// This is duplicated in the `core`, `alloc` test suites (as well as
751
- /// `std`'s integration tests), but figuring out a mechanism to share these
752
- /// seems far more painful than copy-pasting a 7 line function a couple
753
- /// times, given that even under a perma-unstable feature, I don't think we
754
- /// want to expose types from `rand` from `std`.
755
- #[ track_caller]
756
- pub ( crate ) fn test_rng ( ) -> rand_xorshift:: XorShiftRng {
757
- use core:: hash:: { BuildHasher , Hash , Hasher } ;
758
- let mut hasher = crate :: hash:: RandomState :: new ( ) . build_hasher ( ) ;
759
- core:: panic:: Location :: caller ( ) . hash ( & mut hasher) ;
760
- let hc64 = hasher. finish ( ) ;
761
- let seed_vec = hc64. to_le_bytes ( ) . into_iter ( ) . chain ( 0u8 ..8 ) . collect :: < Vec < u8 > > ( ) ;
762
- let seed: [ u8 ; 16 ] = seed_vec. as_slice ( ) . try_into ( ) . unwrap ( ) ;
763
- rand:: SeedableRng :: from_seed ( seed)
764
- }
765
- }
742
+ pub ( crate ) mod test_helpers;
0 commit comments