rust/library/std/tests
bors c6768de2d6 Auto merge of #138062 - LorrensP-2158466:miri-enable-float-nondet, r=RalfJung
Enable Non-determinism of float operations in Miri and change std tests

Links to [#4208](https://github.com/rust-lang/miri/issues/4208) and [#3555](https://github.com/rust-lang/miri/issues/3555) in Miri.

Non-determinism of floating point operations was disabled in rust-lang/rust#137594 because it breaks the tests and doc-tests in core/coretests and std. This PR enables some of them.

This pr includes the following changes:

- Enables the float non-determinism but with a lower relative error of 4ULP instead of 16ULP
- These operations now have a fixed output based on the C23 standard, except the pow operations, this is tracked in [#4286](https://github.com/rust-lang/miri/issues/4286#issue-3010677983)
- Changes tests that made incorrect assumptions about the operations, not to make that assumption anymore (from `assert_eq!` to `assert_approx_eq!`.
- Changed the doctests of the stdlib of these operations to compare against fixed constants instead of `f*::EPSILON`, which now succeed with Miri and `-Zmiri-many-seeds`
- Added a constant `APPROX_DELTA` in `std/tests/floats/f32.rs` which is used for approximation tests, but with a different value when run in Miri. This is to make these tests succeed.
- Added tests in the float tests of Miri to test the C23 behaviour.

Fixes https://github.com/rust-lang/miri/issues/4208
2025-06-09 21:21:58 +00:00
..
common std: get rid of sys_common::io 2025-02-07 16:54:07 +01:00
floats change tests to use fixed constants to let them pass with miri 2025-06-05 16:22:13 +02:00
sync Avoid a gratuitous 10s wait in a stress test 2025-06-08 20:22:07 -07:00
thread_local fix pthread-based tls on apple targets 2025-03-18 20:31:52 +02:00
builtin-clone.rs Run tidy on tests 2024-04-28 18:04:25 -04:00
create_dir_all_bare.rs Fix std tests for wasm32-wasip2 target 2024-09-29 04:48:13 +02:00
env.rs Move env modifying tests to a separate integration test 2025-01-26 10:28:05 +00:00
env_modify.rs std: Apply deprecated_safe_2024 2025-02-13 13:10:28 -08:00
eq-multidispatch.rs Run tidy on tests 2024-04-28 18:04:25 -04:00
error.rs Move std::error unit tests to integration tests 2025-01-26 10:28:04 +00:00
istr.rs Remove some unnecessary parens in assert! conditions 2025-02-06 22:28:44 +00:00
log-knows-the-names-of-variants-in-std.rs Run tidy on tests 2024-04-28 18:04:25 -04:00
minmax-stability-issue-23687.rs Run tidy on tests 2024-04-28 18:04:25 -04:00
num.rs Move std::num unit tests to integration tests 2025-01-26 10:28:04 +00:00
panic.rs Move std::panic unit tests to integration tests 2025-01-26 10:28:04 +00:00
path.rs Stabilised os_string_pathbuf_leak 2025-06-06 12:06:42 -07:00
pipe_subprocess.rs Stablize feature anonymous_pipe 2025-03-14 00:52:45 +11:00
process_spawning.rs Fix testing of the standard library with Emscripten 2025-01-24 09:25:34 +00:00
run-time-detect.rs expose is_s390x_feature_detected from std::arch 2025-03-09 14:04:39 +01:00
seq-compare.rs Remove some unnecessary parens in assert! conditions 2025-02-06 22:28:44 +00:00
slice-from-array-issue-113238.rs Move various stdlib tests to library/std/tests 2024-04-28 16:10:12 -04:00
switch-stdout.rs Mark extern blocks as unsafe 2025-02-09 17:11:13 +00:00
thread.rs Avoid shadowing user provided types or type aliases in thread_local! 2024-10-18 10:27:41 +08:00
time.rs Move std::time unit tests to integration tests 2025-01-26 10:28:04 +00:00
type-name-unsized.rs Rename test for issue 21058 2024-05-05 10:47:12 -04:00
volatile-fat-ptr.rs Move various stdlib tests to library/std/tests 2024-04-28 16:10:12 -04:00
win_delete_self.rs ignore win_delete_self test in Miri 2025-02-10 08:08:32 +01:00
windows.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00