add special exception for std_miri_test crate to call std-only functions
These being the unit tests of std, they have their own copy of `std::sys` and `std::thread`, so the existing check says this is not std. The check is correct but we want to allow this so we just hard-code the crate name.
The point of this `frame_in_std` check is to prevent people from directly interacting with shims that aren't really properly implemented, but it doesn't need to be 100% airtight. If someone really wants to call their crate `std_miri_test` in order to access some broken shims... they can keep the pieces.
clarifying comments for target-dir handling
I thought we could simplify this logic, but alas, `cargo metadata --target-dir` is not a thing (even though the effective target-dir *does* affect the metadata).
fix RUSTC_BACKTRACE always being set
I kept wondering why Miri programs, whenever isolation is disabled, behave as if RUSTC_BACKTRACE was set. Finally I realized it's because some early rustc setup code sets that env var, and that is then propagated to the interpreted program.
So fix that by taking a copy of the environment before any rustc setup, and use that copy as the basis for what is provided to the interpreted program.
implement some missing float functions
With this we support the entire float API surface of the standard library. :)
Also fixes https://github.com/rust-lang/miri/issues/2468 by using host floats to implement FMA.
avoid strerror_r failure on unknown errnum
This is an informative function anyway, so as fallback just return a string with the raw errnum. Avoids panics / interpreter aborts in std on unknown errnum in from_raw_os_error.
Add additional raw error mappings for the nightly `io_error_more` feature
Some crates are using nightly and failing when mapping these errors,
for example <https://miri.saethlin.dev/?crate=remove_dir_all&version=0.7.0>:
```
error: unsupported operation: io error NotADirectory cannot be translated into a raw os error
--> /root/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:1203:19
```