Tracking Issue for `core::clone::CloneToUninit` trait
Open
Nobody has claimed this yet.
C-tracking-issue
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(clone_to_uninit)]
This is a tracking issue for CloneToUninit and its impls. This trait backs the behavior of Rc::make_mut and Arc::make_mut, and likely in the future also Box::clone.
Public API
// core::clone
pub unsafe trait CloneToUninit {
unsafe fn clone_to_uninit(&self, dst: *mut Self);
}
unsafe impl<T: Clone> CloneToUninit for T;
unsafe impl<T: Clone> CloneToUninit for [T];
// TODO:
// unsafe impl CloneToUninit for str;
// unsafe impl CloneToUninit for CStr;
// unsafe impl CloneToUninit for OsStr;
// unsafe impl CloneToUninit for Path;
Steps / History
- Implementation: https://github.com/rust-lang/rust/pull/116113
- https://github.com/rust-lang/rust/pull/126877
- Convert
Box::cloneto be based onCloneToUninit - Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- Consider using
*mut ()in the signature instead of*mut Self. This makes CloneToUninit dyn-safe. https://github.com/rust-lang/rust/pull/116113#discussion_r1335303908
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the core::clone::CloneToUninit public API and review the linked work for converting Box::clone, alongside its use by Rc::make_mut and Arc::make_mut. Done means resolving the *mut Self versus *mut () question, completing the remaining checklist items, and preparing the feature for FCP and stabilization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100