Skip to content

Commit 3205704

Browse files
update comments
1 parent 6ed88f0 commit 3205704

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn get_rng_danger() -> &'static mut (dyn RngCore + Send + Sync) {
8989
}
9090

9191
// SAFETY: If randomness source is not already set, the whole program panics due to the unwrap
92-
// UNSAFETY: If you have a memory corruption (whether stack or heap or not), this could
92+
// UNSAFETY: If you have a memory corruption (whether stack or heap or not), this assumption could be violated
9393
#[allow(static_mut_refs)]
9494
unsafe {
9595
RNG.get_mut().expect("RNG was not set").as_mut()
@@ -98,7 +98,7 @@ fn get_rng_danger() -> &'static mut (dyn RngCore + Send + Sync) {
9898

9999
// Initialize an RNG source, and panic if it was already set, which would only happen if two threads set the data at the same time.
100100
// This ensures the user would have to decide on the RNG source at the very beginning, likely the first function call in main and find way to provide entropy themselves
101-
// TIP: Use Box::from_raw to prevent having to do real heap allocation if you can assume your program to be single-threaded and your put RNG state as a global variable
101+
// TIP: Use Box::from_raw to prevent having to do real heap allocation if you can assume your program to be single-threaded and you put RNG state as a global variable, which is usually useful for MCUs
102102
#[cfg(feature = "alloc")]
103103
pub fn init_randomness_source(rng: Box<dyn RngCore + Send + Sync>) {
104104
// SAFETY: If randomness source is already set, the whole program panics

0 commit comments

Comments
 (0)