File tree 5 files changed +13
-2
lines changed
5 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.
13
13
- Bump the MSRV to 1.61.0
14
14
- Rename ` Rng::gen ` to ` Rng::random ` to avoid conflict with the new ` gen ` keyword in Rust 2024 (#1435 )
15
15
- Move all benchmarks to new ` benches ` crate (#1439 )
16
- - Annotate panicking methods with ` #[track_caller] ` (#1442 )
16
+ - Annotate panicking methods with ` #[track_caller] ` (#1442 , # 1447 )
17
17
18
18
## [ 0.9.0-alpha.1] - 2024-03-18
19
19
- Add the ` Slice::num_choices ` method to the Slice distribution (#1402 )
Original file line number Diff line number Diff line change 12
12
//! useful functions available.
13
13
14
14
/// Reads unsigned 32 bit integers from `src` into `dst`.
15
+ ///
16
+ /// # Panics
17
+ ///
18
+ /// If `dst` has insufficent space (`4*dst.len() < src.len()`).
15
19
#[ inline]
20
+ #[ track_caller]
16
21
pub fn read_u32_into ( src : & [ u8 ] , dst : & mut [ u32 ] ) {
17
22
assert ! ( src. len( ) >= 4 * dst. len( ) ) ;
18
23
for ( out, chunk) in dst. iter_mut ( ) . zip ( src. chunks_exact ( 4 ) ) {
@@ -21,7 +26,12 @@ pub fn read_u32_into(src: &[u8], dst: &mut [u32]) {
21
26
}
22
27
23
28
/// Reads unsigned 64 bit integers from `src` into `dst`.
29
+ ///
30
+ /// # Panics
31
+ ///
32
+ /// If `dst` has insufficent space (`8*dst.len() < src.len()`).
24
33
#[ inline]
34
+ #[ track_caller]
25
35
pub fn read_u64_into ( src : & [ u8 ] , dst : & mut [ u64 ] ) {
26
36
assert ! ( src. len( ) >= 8 * dst. len( ) ) ;
27
37
for ( out, chunk) in dst. iter_mut ( ) . zip ( src. chunks_exact ( 8 ) ) {
Original file line number Diff line number Diff line change @@ -438,7 +438,6 @@ pub trait SeedableRng: Sized {
438
438
/// [`try_from_os_rng`]: SeedableRng::try_from_os_rng
439
439
#[ cfg( feature = "getrandom" ) ]
440
440
#[ cfg_attr( doc_cfg, doc( cfg( feature = "getrandom" ) ) ) ]
441
- #[ track_caller]
442
441
fn from_os_rng ( ) -> Self {
443
442
match Self :: try_from_os_rng ( ) {
444
443
Ok ( res) => res,
Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ impl<W: Clone + PartialEq + PartialOrd + SampleUniform + SubAssign<W> + Weight>
290
290
impl < W : Clone + PartialEq + PartialOrd + SampleUniform + SubAssign < W > + Weight > Distribution < usize >
291
291
for WeightedTreeIndex < W >
292
292
{
293
+ #[ track_caller]
293
294
fn sample < R : Rng + ?Sized > ( & self , rng : & mut R ) -> usize {
294
295
self . try_sample ( rng) . unwrap ( )
295
296
}
Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ impl ExactSizeIterator for IndexVecIntoIter {}
219
219
/// to adapt the internal `sample_floyd` implementation.
220
220
///
221
221
/// Panics if `amount > length`.
222
+ #[ track_caller]
222
223
pub fn sample < R > ( rng : & mut R , length : usize , amount : usize ) -> IndexVec
223
224
where R : Rng + ?Sized {
224
225
if amount > length {
You can’t perform that action at this time.
0 commit comments