rust/library/std/src
bors 2afe58571e Auto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrum
Update `rand` in the stdlib tests, and remove the `getrandom` feature from it.

The main goal is actually removing `getrandom`, so that eventually we can allow running the stdlib test suite on tier3 targets which don't have `getrandom` support. Currently those targets can only run the subset of stdlib tests that exist in uitests, and (generally speaking), we prefer not to test libstd functionality in uitests, which came up recently in https://github.com/rust-lang/rust/pull/104095 and https://github.com/rust-lang/rust/pull/104185. Additionally, the fact that we can't update `rand`/`getrandom` means we're stuck with the old set of tier3 targets, so can't test new ones.

~~Anyway, I haven't checked that this actually does allow use on tier3 targets (I think it does not, as some work is needed in stdlib submodules) but it moves us slightly closer to this, and seems to allow at least finally updating our `rand` dep, which definitely improves the status quo.~~ Checked and works now.

For the most part, our tests and benchmarks are fine using hard-coded seeds. A couple tests seem to fail with this (stuff manipulating the environment expecting no collisions, for example), or become pointless (all inputs to a function become equivalent). In these cases I've done a (gross) dance (ab)using `RandomState` and `Location::caller()` for some extra "entropy".

Trying to share that code seems *way* more painful than it's worth given that the duplication is a 7-line function, even if the lines are quite gross. (Keeping in mind that sharing it would require adding `rand` as a non-dev dep to std, and exposing a type from it publicly, all of which sounds truly awful, even if done behind a perma-unstable feature).

See also some previous attempts:
- https://github.com/rust-lang/rust/pull/86963 (in particular https://github.com/rust-lang/rust/pull/86963#issuecomment-885438936 which explains why this is non-trivial)
- https://github.com/rust-lang/rust/pull/89131
- https://github.com/rust-lang/rust/pull/96626#issuecomment-1114562857 (I tried in that PR at the same time, but settled for just removing the usage of `thread_rng()` from the benchmarks, since that was the main goal).
- https://github.com/rust-lang/rust/pull/104185
- Probably more. It's very tempting of a thing to "just update".

r? `@Mark-Simulacrum`
2023-01-08 01:34:05 +00:00
..
backtrace Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
collections Auto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrum 2023-01-08 01:34:05 +00:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error remove fn backtrace 2022-08-01 20:10:40 +00:00
f32 Improve accuracy of asinh and acosh 2022-11-17 12:50:33 -08:00
f64 Improve accuracy of asinh and acosh 2022-11-17 12:50:33 -08:00
ffi Guarantee try_reserve preserves the contents on error 2022-08-10 01:51:38 +09:00
fs Update rand in the stdlib tests, and remove the getrandom feature from it 2023-01-04 14:52:41 -08:00
io Document a way to limit read_line length 2023-01-01 18:04:26 +00:00
net Rollup merge of #104182 - gabhijit:ipv6-in6addr-any-doc-fix, r=m-ou-se 2022-12-30 17:01:39 +01:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os enable fuzzy_provenance_casts lint in libstd 2022-11-20 19:23:28 +01:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path make many std tests work in Miri 2022-08-18 18:07:39 -04:00
personality enable fuzzy_provenance_casts lint in libstd 2022-11-20 19:23:28 +01:00
prelude Update bootstrap cfg 2022-12-28 09:18:43 -05:00
process More verbose Debug implementation of std::process:Command 2022-12-27 09:50:01 +01:00
sync Update rand in the stdlib tests, and remove the getrandom feature from it 2023-01-04 14:52:41 -08:00
sys Rollup merge of #105903 - joboet:unify_parking, r=m-ou-se 2022-12-30 21:26:33 -08:00
sys_common Update rand in the stdlib tests, and remove the getrandom feature from it 2023-01-04 14:52:41 -08:00
thread Rollup merge of #105903 - joboet:unify_parking, r=m-ou-se 2022-12-30 21:26:33 -08:00
time Fix non-associativity of Instant math on aarch64-apple-darwin targets 2022-11-13 12:01:42 -08:00
alloc.rs default OOM handler: use non-unwinding panic (unless -Zoom=panic is set), to match std handler 2023-01-02 16:35:14 +01:00
ascii.rs Remove use of #[rustc_deprecated] 2022-04-14 01:33:13 -04:00
backtrace.rs Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
env.rs Rollup merge of #101648 - Timmmm:home_dir_docs, r=joshtriplett 2022-12-11 23:36:44 +01:00
error.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
f32.rs Improve accuracy of asinh and acosh 2022-11-17 12:50:33 -08:00
f64.rs Improve accuracy of asinh and acosh 2022-11-17 12:50:33 -08:00
fs.rs Rollup merge of #105100 - jhpratt:fix-docs, r=JohnTitor 2022-12-03 12:51:28 +09:00
keyword_docs.rs review feedback 2022-10-07 15:21:47 +02:00
lib.rs Auto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrum 2023-01-08 01:34:05 +00:00
macros.rs Add tidy check for dbg 2022-12-31 15:32:09 +05:30
num.rs Add Saturating type (based on Wrapping type) 2021-08-10 19:27:01 +02:00
panic.rs Clarify catch_unwind docs about panic hooks 2022-12-28 16:54:42 +01:00
panicking.rs Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
path.rs Rollup merge of #104298 - tbu-:pr_set_extension_caveats, r=m-ou-se 2023-01-02 15:39:16 -08:00
personality.rs Move personality functions to std 2022-08-23 16:12:58 +08:00
primitive_docs.rs disable strict-provenance-violating doctests in Miri 2022-11-22 11:49:02 +01:00
process.rs delete more cfg(bootstrap) 2022-12-28 09:18:43 -05:00
rt.rs Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
time.rs Bump version placeholders to release 2022-11-06 17:11:02 -05:00