mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-02 01:08:19 +00:00
Add `Box::clone_from_ref` and similar under `feature(clone_from_ref)` Tracking issue: https://github.com/rust-lang/rust/issues/149075 Accepted ACP: https://github.com/rust-lang/libs-team/issues/483 This PR implements `clone_from_ref` (and `try_*` and `_*in` variants), to get a `Box<T>`, `Arc<T>`, or `Rc<T>` by cloning from a `&T` where `T: CloneToUninit`. The "Implement..." commits replace some ad-hoc conversions with `clone_from_ref` variants, which can be split out to a separate PR if desired. This PR will conflict with https://github.com/rust-lang/rust/pull/148769 due to usage of `Layout::dangling` (which that PR is renaming to `dangling_ptr`), so they should not be rolled up together, and the one which merges later will need to be amended.