rustdoc: Add option to persist doc test executables
Fixes#37048.
This is the initial version of the code so the doctest executables can be used for stuff like code coverage (specifically https://github.com/xd009642/tarpaulin/issues/13) the folders it goes into were just a first idea, so any better ones are welcome.
Right now it creates a directory structure like:
```
given_path/
|_____ <filename>_rs_<linenum>/
|_____ ...
|_____ <filename>_rs_<linenum>/
|_____ rust_out
```
I couldn't figure out where it actually outputs the file w/ the name, I suspect its somewhere deeper in the compiler.
It also adds the unstable `--persist-doctests` flag to `rustdoc` that enables this behavior.
Move spin_loop_hint to core::hint module
As mentioned in #55002. The new name is kept unstable to decide whether the function should have `_hint` in its name.
Additionally, the root implementation was changed a bit: it now uses
`all` instead of coding that logic manually.
To avoid duplicate code, the inherent `[T]::is_sorted_by` method now
calls `self.iter().is_sorted_by(...)`. This should always be inlined
and not result in overhead.
This requires restructuring things a little so that there is only one
callsite, ensuring that inlinining doesn't cause unnecessary code bloat.
This reduces instruction counts for the `unicode_normalization`
benchmark by up to 4%.
Multiple people have asked for them, in
https://github.com/rust-lang/rust/issues/49137.
Given that the unsigned ones already exist,
they are very easy to add and not an additional maintenance burden.
Turns out that the equality check for regions is rather expensive, and
the current early exit check works in such a way, that the comparison is
even done twice. As we only really care about the case of equal scopes,
we can perform a faster, more specialized check and move it up one
level, so we can eventually skip the additional full comparison as well.