File tree Expand file tree Collapse file tree 5 files changed +13
-2
lines changed Expand file tree Collapse file tree 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.
1313- Bump the MSRV to 1.61.0
1414- Rename ` Rng::gen ` to ` Rng::random ` to avoid conflict with the new ` gen ` keyword in Rust 2024 (#1435 )
1515- 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 )
1717
1818## [ 0.9.0-alpha.1] - 2024-03-18
1919- Add the ` Slice::num_choices ` method to the Slice distribution (#1402 )
Original file line number Diff line number Diff line change 1212//! useful functions available.
1313
1414/// Reads unsigned 32 bit integers from `src` into `dst`.
15+ ///
16+ /// # Panics
17+ ///
18+ /// If `dst` has insufficent space (`4*dst.len() < src.len()`).
1519#[ inline]
20+ #[ track_caller]
1621pub fn read_u32_into ( src : & [ u8 ] , dst : & mut [ u32 ] ) {
1722 assert ! ( src. len( ) >= 4 * dst. len( ) ) ;
1823 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]) {
2126}
2227
2328/// Reads unsigned 64 bit integers from `src` into `dst`.
29+ ///
30+ /// # Panics
31+ ///
32+ /// If `dst` has insufficent space (`8*dst.len() < src.len()`).
2433#[ inline]
34+ #[ track_caller]
2535pub fn read_u64_into ( src : & [ u8 ] , dst : & mut [ u64 ] ) {
2636 assert ! ( src. len( ) >= 8 * dst. len( ) ) ;
2737 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 {
438438 /// [`try_from_os_rng`]: SeedableRng::try_from_os_rng
439439 #[ cfg( feature = "getrandom" ) ]
440440 #[ cfg_attr( doc_cfg, doc( cfg( feature = "getrandom" ) ) ) ]
441- #[ track_caller]
442441 fn from_os_rng ( ) -> Self {
443442 match Self :: try_from_os_rng ( ) {
444443 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>
290290impl < W : Clone + PartialEq + PartialOrd + SampleUniform + SubAssign < W > + Weight > Distribution < usize >
291291 for WeightedTreeIndex < W >
292292{
293+ #[ track_caller]
293294 fn sample < R : Rng + ?Sized > ( & self , rng : & mut R ) -> usize {
294295 self . try_sample ( rng) . unwrap ( )
295296 }
Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ impl ExactSizeIterator for IndexVecIntoIter {}
219219/// to adapt the internal `sample_floyd` implementation.
220220///
221221/// Panics if `amount > length`.
222+ #[ track_caller]
222223pub fn sample < R > ( rng : & mut R , length : usize , amount : usize ) -> IndexVec
223224where R : Rng + ?Sized {
224225 if amount > length {
You can’t perform that action at this time.
0 commit comments