-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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: Generalize
{Rc,Arc}::make_mut()
to unsized types. #116113 - CloneToUninit impls #126877
- Convert
Box::clone
to 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. Generalize{Rc,Arc}::make_mut()
to unsized types. #116113 (comment)
Footnotes
joseluis
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.