make_rng: document panic and add #[track_caller] by maxider · Pull Request #1761 · rust-random/rand (original) (raw)

Summary

Document that make_rng can panic, and add #[track_caller] to improve panic diagnostics.

Motivation

make_rng calls expect on the result of SysRng seeding, but had no # Panics section in its doc comment. This is inconsistent with the rest of the crate where panicking functions document the conditions (e.g. random_range, random_bool, random_ratio), and the #[track_caller] convention established in #1447.

Details