-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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 RFCI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.S-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-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(cell_get_cloned)]
This is a tracking issue for Cell::get_cloned
for T: CloneFromCopy
(e.g. Rc<T>
, Arc<T>
, etc.).
Public API
/// Safety: can call `Self::clone(&*ManuallyDrop::new(ptr::read(ptr_to_self)))`
#[marker]
pub unsafe trait CloneFromCopy: Clone {}
unsafe impl<T: Copy> CloneFromCopy for T {}
unsafe impl<T: ?Sized> CloneFromCopy for Rc<T> {}
unsafe impl<T: ?Sized> CloneFromCopy for Arc<T> {}
unsafe impl<T: ?Sized> CloneFromCopy for rc::Weak<T> {}
unsafe impl<T: ?Sized> CloneFromCopy for sync::Weak<T> {}
// basically all std types that don't have indirection:
unsafe impl<T: CloneFromCopy, const N: usize> CloneFromCopy for [T; N] {}
unsafe impl<T: CloneFromCopy> CloneFromCopy for Option<T> {}
unsafe impl<T: CloneFromCopy, E: CloneFromCopy> CloneFromCopy for Result<T, E> {}
// ...
impl<T: CloneFromCopy> Cell<T> {
pub fn get_cloned(&self) -> Self;
}
Steps / History
(Remember to update the S-tracking-*
label when checking boxes.)
- Implementation: #...
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.
cc @rust-lang/libs-api @rust-lang/lang
Footnotes
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 RFCI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.S-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-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.