File tree Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Expand file tree Collapse file tree 4 files changed +12
-1
lines changed 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 @@ -385,7 +385,6 @@ pub trait SeedableRng: Sized {
385385 /// [`getrandom`]: https://docs.rs/getrandom
386386 #[ cfg( feature = "getrandom" ) ]
387387 #[ cfg_attr( doc_cfg, doc( cfg( feature = "getrandom" ) ) ) ]
388- #[ track_caller]
389388 fn from_entropy ( ) -> Self {
390389 let mut seed = Self :: Seed :: default ( ) ;
391390 if let Err ( err) = getrandom:: getrandom ( seed. as_mut ( ) ) {
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