diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c32e4ef14..5e220fcdea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ A [separate changelog is kept for rand_core](https://github.com/rust-random/core You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful. +## [Unreleased] +- Document panic behavior of `make_rng` and add `#[track_caller]` (#1761) + ## [0.10.0] - 2026-02-08 ### Changes diff --git a/src/lib.rs b/src/lib.rs index a3ad2a38b8..c7b85b94d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,6 +102,11 @@ use crate::distr::{Distribution, StandardUniform}; /// # let _ = rand::Rng::next_u32(&mut rng); /// ``` /// +/// # Panics +/// +/// If [`SysRng`] fails to obtain entropy from the OS. This is unlikely +/// outside of early boot or unusual system conditions. +/// /// # Security /// /// Refer to [`ThreadRng#Security`]. @@ -110,6 +115,7 @@ use crate::distr::{Distribution, StandardUniform}; /// [`ThreadRng`]: crate::rngs::ThreadRng /// [`ThreadRng#Security`]: crate::rngs::ThreadRng#security #[cfg(feature = "sys_rng")] +#[track_caller] pub fn make_rng() -> R { #[cfg(feature = "thread_rng")] {