io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`
Use `NonNull` a few more places to avoid the need to convert to and from `*mut T`. Also document the invariants for `Custom`.
Add `core::num::Complex`
tracking issue: https://github.com/rust-lang/rust/issues/154023
See also [#t-compiler > representing `_Complex`](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/representing.20.60_Complex.60/with/608308993). The RFC states that the `Complex` type should match the ABI of `_Complex` in C, but provides little detail on how to actually achieve this. We concluded that `repr(complex)` is probably the best approach. Like clang, that means we "desugar" the representation early: `_Complex` is not natively represented in LLVM IR.
I've derived the ABI from `clang` for 28 targets, a decent sample of what we actually support. For now I'm only actually testing `x86_64` because (as you'll see) updating the tests is quite labor-intensive. If we're happy with this direction I can fill more of them in, likely in a separate PR.
The libs side of the type is very bare-bones: I'm not as interested in that part. Others can fill in the various instances, methods, write tests for those, and improve the docs.
r? workingjubilee
Optimize CStr backing slice bounds checks
Hint that Cstr is non empty bcs it always contains the null byte. Byte-zero access reduces from 27 to 4 bytes
Rollup of 8 pull requests
Successful merges:
- rust-lang/rust#159593 (merge ambiguity errors that blame the same inference variable)
- rust-lang/rust#160687 (Experiment: Add `core::cmp::smallest` and `core::cmp::largest`)
- rust-lang/rust#160856 (Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails)
- rust-lang/rust#160961 (bootstrap: Overhaul matching of command-line selectors to steps)
- rust-lang/rust#160975 (Remove target argument from get_proc_macros)
- rust-lang/rust#161023 (bootstrap: Replace the `exit!` macro with a function `helpers::exit_process`)
- rust-lang/rust#160932 (Make tidy::Version public)
- rust-lang/rust#161029 (mailmap: Update my default email)
Experiment: Add `core::cmp::smallest` and `core::cmp::largest`
Tracking Issue: rust-lang/rust#160728
Zulip: [#t-libs-api/api-changes > variadic min/max](https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs-api.2Fapi-changes/topic/variadic.20min.2Fmax/with/570428142)
# Description
Adds variadic alternatives to `cmp::min` and `cmp::max` which use `#[rustc_splat]` to allow anywhere from 1 to 12 arguments to be compared. Twelve chosen as an arbitrary limit. This doesn't have a pre-existing ACP or tracking issue (linking the `splat` issue since it's the most relevant), so I've added these two functions, `smallest` and `largest` under a new feature, `cmp_splat`.
This mostly exists to demonstrate a possible solution to the problem posited in the linked Zulip thread. Happy to close if undesirable, as my current focus is on `no_std` I/O.
core: Improve the documentation for funnel shifts
Change the variable name to make things a bit more clear, then rework funnel shift documentation. Examples now cover shifting by zero and emulating rotates.
Tracking issue: https://github.com/rust-lang/rust/issues/145686
Enforce more library clippy lints in CI
Best reviewed commit by commit.
This is testing the waters for enforcing more clippy lints. I've chosen these ones because we mostly adhere to them already (at least in core/alloc/std) so we can reduce the noise in `./x clippy` by fixing or allowing the relatively few violations.
Implement derives for Reborrow and CoerceShared
This adds built-in derive support for the experimental `Reborrow` and `CoerceShared` marker traits behind `#![feature(reborrow)]`.
The derives generate the same marker impls users would write manually, while preserving the existing coherence and structural validation path for the experimental reborrow traits.
## Please note this impl:
- Preserves generics, lifetimes, const params, and where clauses in generated impls.
- Preserves multiple lifetime parameters in generated impls instead of duplicating the current experimental one-lifetime limitation in the derive layer.
- Requires an explicit `CoerceShared` target type through the derive helper attribute.
- Adds UI coverage for valid derives, feature gating, malformed helper attributes, unsupported item kinds, validation failures, and multiple-lifetime derive behavior.
- Makes the derive layer future-proof for multiple lifetimes: it preserves all lifetime parameters and generates the same impl shape as a manual impl.
@rustbot label F-reborrow
Tracking: https://github.com/rust-lang/rust/issues/145612
Implement <OnceCell,OnceLock>::new_init
Tracking issues: rust-lang/rust#159859rust-lang/rust#159860
I'm not sure If I was supposed to add any other tests apart from the doc tests.
core: generalize `BorrowedCursor::ensure_init`
Tracking issue: https://github.com/rust-lang/rust/issues/160476
This implements the future possibility left out in https://github.com/rust-lang/rust/pull/149749#issue-3704149674 and makes `ensure_init` generic over `Default`. I used specialisation to make sure the performance in the `u8` case stays equivalent to `memset` irrespective of how clever the optimiser happens to be.
CC @joshtriplett as you've been working on this stuff recently.
This also adds a public `write_default` method on `[MaybeUninit<T>]` that's doing the equivalent of `.write_init(|_| Default::default())`, but uses specialisation for integers. This uses the existing [tracking issue for `maybe_uninit_fill`](https://github.com/rust-lang/rust/issues/117428).