support building Miri outside a git repo
Fixes https://github.com/rust-lang/rust/issues/84182
`@semarie` this should fix your problem... but I think any version of Miri actually shipped to users should have the proper git version information embedded, so I am not sure if this is the right fix. How do you do this for rustc proper? Even stable builds usually have a git version:
```
$ rustc +stable --version
rustc 1.51.0 (2fd73fabe 2021-03-23)
```
Sync with rustc_span changes
rust-lang/rust#83813 made some changes to SourceMap and RealFileName. Now to get a string from a `rustc_span::FileName`, we need to specify if we would like the local filesystem path or remapped path via `--remap-path-prefix`. There seems to be only one place in miri that requires change.
stacked borrows: ensure array-to-elem casts behave correctly
When "as"-casting an entire array, that should create a raw ptr usable for all elements in the array, even if we immediately cast to the element type.
Throw UB if f*_fast intrinsic called with non-finite value
Calling these intrinsics with non-finite values is undefined behaviour, since they result in `f*` intrinsics in LLVM with the `fast` flag, and `fast` math on non-finite values results in `poison` values. (technically LLVM only considers it UB upon _using_ the value, but that shouldn't make much of a difference)
Use `harness = false` instead of `#![feature(custom_test_frameworks)]`
Quoting from the comment in `tests/compiletest.rs`:
> Custom test runner, to avoid libtest being wrapped around compiletest which wraps libtest.
I believe `harness = false` is more suitable for that purpose.
I have verified that both `./miri test` and `LD_LIBRARY_PATH=$PWD/build/x86_64-unknown-linux-gnu/stage2/lib PATH=$PWD/build/bin:$PATH ./x.py test src/tools/miri` work well.
remove compatibility code for passing miri flags via cargo arguments
With https://github.com/rust-lang/miri/pull/1540, we deprecated `cargo miri test -- -Zmiri-disable-stacked-borrows` as a style of passing flags to Miri, introducing `MIRIFLAGS="-Zmiri-disable-stacked-borrows" cargo miri test` instead. This made `cargo miri` more compatible with `cargo`; both now behave the same in terms of argument parsing.
However, to avoid breaking things, I introduced some backwards compatibility hack such that the old way would still work. Six months later, I think it is time to remove that hack.