Deprecate offset_to; switch core&alloc to using offset_from instead
Bonus: might make code than uses `.len()` on slice iterators faster
cc https://github.com/rust-lang/rust/issues/41079
Merge the std_unicode crate into the core crate
[The standard library facade](https://github.com/rust-lang/rust/issues/27783) has historically contained a number of crates with different roles, but that number has decreased over time. `rand` and `libc` have moved to crates.io, and [`collections` was merged into `alloc`](https://github.com/rust-lang/rust/pull/42648). Today we have `core` that applies everywhere, `std` that expects a full operating system, and `alloc` in-between that only requires a memory allocator (which can be provided by users)… and `std_unicode`, which doesn’t really have a reason to be separate anymore. It contains functionality based on Unicode data tables that can be large, but as long as relevant functions are not called the tables should be removed from binaries by linkers.
This deprecates the unstable `std_unicode` crate and moves all of its contents into `core`, replacing them with `pub use` reexports. The crate can be removed later. This also removes the `CharExt` trait (replaced with inherent methods in libcore) and `UnicodeStr` trait (merged into `StrExt`). There traits were both unstable and not intended to be used or named directly.
A number of new items are newly-available in libcore and instantly stable there, but only if they were already stable in libstd.
Fixes#49319.
Rollup of 14 pull requests
Successful merges:
- #49525 (Use sort_by_cached_key where appropriate)
- #49575 (Stabilize `Option::filter`.)
- #49614 (in which the non-shorthand patterns lint keeps its own counsel in macros)
- #49665 (Small nits to make couple of tests pass on mips targets.)
- #49781 (add regression test for #16223 (NLL): use of collaterally moved value)
- #49795 (Properly look for uninhabitedness of variants in niche-filling check)
- #49809 (Stop emitting color codes on TERM=dumb)
- #49856 (Do not uppercase-lint #[no_mangle] statics)
- #49863 (fixed typo)
- #49857 (Fix "fp" target feature for AArch64)
- #49849 (Add --enable-debug flag to musl CI build script)
- #49734 (proc_macro: Generalize `FromIterator` impl)
- #49730 (Fix ICE with impl Trait)
- #48270 (Replace `structurally_resolved_type` in casts check.)
Failed merges:
Replace `structurally_resolved_type` in casts check.
The behaviour of `resolve_type_vars_if_possible` is simpler and infallible. Other minor refactorings.
I'm not sure if this is backwards compatible, in theory resolving obligations between two cast checks could solve a dependency between them, but I don't know if that's actually possible and it doesn't sound like something we'd want to support.
proc_macro: Generalize `FromIterator` impl
While never intended to be stable we forgot that trait impls are insta-stable!
This construction of `FromIterator` wasn't our first choice of how to stabilize
the impl but our hands are tied at this point, so revert back to the original
definition of `FromIterator` before #49597Closes#49725
Add --enable-debug flag to musl CI build script
Building for x86_64-unknown-linux-musl currently results in an executable lacking debug information for musl libc itself. If you request a backtrace in GDB while control flow is within musl – including sycalls made by musl – the result looks like:
```
#0 0x0000000000434b46 in __cp_end ()
#1 0x0000000000432dbd in __syscall_cp_c ()
#2 0x0000000000000000 in ?? ()
```
i.e. not very helpful. Adding --enable-debug resolves this, and --enable-optimize re-enables optimisations which default to off given the previous flag.
Fix "fp" target feature for AArch64
This fixes the following warning on AArch64:
```
'+fp' is not a recognized feature for this target (ignoring feature)
```
Fixes#49782
Do not uppercase-lint #[no_mangle] statics
The reasoning being that `#[no_mangle]` expresses enough intention that there's likely a good reason for the name.
Fixes#36258.