rust/library/core
bors f944afe380 Auto merge of #116113 - kpreid:arcmut, r=dtolnay
Generalize `{Rc,Arc}::make_mut()` to unsized types.

* `{Rc,Arc}::make_mut()` now accept any type implementing the new unstable trait `core::clone::CloneToUninit`.
* `CloneToUninit` is implemented for `T: Clone` and for `[T] where T: Clone`.
* `CloneToUninit` is a generalization of the existing internal trait `alloc::alloc::WriteCloneIntoRaw`.
* New feature gate: `clone_to_uninit`

This allows performing `make_mut()` on `Rc<[T]>` and `Arc<[T]>`, which was not previously possible.

---

Previous PR description, now obsolete:

>  Add `{Rc, Arc}::make_mut_slice()`
>
> These functions behave identically to `make_mut()`, but operate on `Arc<[T]>` instead of `Arc<T>`.
>
> This allows performing the operation on slices, which was not previously possible because `make_mut()` requires `T: Clone` (and slices, being `!Sized`, do not and currently cannot implement `Clone`).
>
> Feature gate: `make_mut_slice`

try-job: test-various
2024-06-22 16:35:29 +00:00
..
benches Write char::DebugEscape sequences using write_str 2024-05-20 10:04:44 +02:00
src Auto merge of #116113 - kpreid:arcmut, r=dtolnay 2024-06-22 16:35:29 +00:00
tests Auto merge of #116113 - kpreid:arcmut, r=dtolnay 2024-06-22 16:35:29 +00:00
Cargo.toml Remove now outdated comment since we bumped stage0 2024-05-24 08:08:41 +02:00