rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
93.58k stars 12.05k forks source link

std::rand: adding solaris/illumos for getrandom support. #124766

Closed devnexen closed 1 week ago

devnexen commented 1 week ago

To help solarish support for miri https://https://github.com/rust-lang/miri/issues/3567

rustbot commented 1 week ago

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

RalfJung commented 1 week ago

Cc @josephlr who just filed https://github.com/rust-random/getrandom/pull/417

RalfJung commented 1 week ago

For the uses in libstd (generating random hashmap seeds), using getrandom with flags = 0 is definitely the right call (on both illumos and Solaris). You also don't have to worry about maximum buffer size issues on Solaris as you will only be requesting 16 bytes at a time.

Maybe there should be a comment explaining that. It seems confusing that this would use a different function than the getrandom crate.

RalfJung commented 1 week ago

This helps with https://github.com/rust-lang/miri/issues/3567.

(@devnexen when you open a PR that is related to some issue, please mention the issue in the PR description. That helps give context to the reviewer, and to whoever is looking at the issue it helps determine the current status. Generally, PRs should almost always have a description that explains what is done and why.)

Mark-Simulacrum commented 1 week ago

@bors r+ rollup

bors commented 1 week ago

:pushpin: Commit 1d45f47d24e43546b2a3e71fea80660c86343f41 has been approved by Mark-Simulacrum

It is now in the queue for this repository.