File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -971,14 +971,16 @@ impl<T> ManuallyDrop<T> {
971
971
ManuallyDrop { value }
972
972
}
973
973
974
- /// Extract the value from the ManuallyDrop container.
974
+ /// Extract the value from the `ManuallyDrop` container.
975
+ ///
976
+ /// This allows the value to be dropped again.
975
977
///
976
978
/// # Examples
977
979
///
978
980
/// ```rust
979
981
/// use std::mem::ManuallyDrop;
980
982
/// let x = ManuallyDrop::new(Box::new(()));
981
- /// let _: Box<()> = ManuallyDrop::into_inner(x);
983
+ /// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
982
984
/// ```
983
985
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
984
986
#[ inline]
@@ -990,11 +992,15 @@ impl<T> ManuallyDrop<T> {
990
992
impl < T : ?Sized > ManuallyDrop < T > {
991
993
/// Manually drops the contained value.
992
994
///
995
+ /// If you have ownership of the value, you can use [`ManuallyDrop::into_inner`] instead.
996
+ ///
993
997
/// # Safety
994
998
///
995
999
/// This function runs the destructor of the contained value and thus the wrapped value
996
1000
/// now represents uninitialized data. It is up to the user of this method to ensure the
997
1001
/// uninitialized data is not actually used.
1002
+ ///
1003
+ /// [`ManuallyDrop::into_inner`]: #method.into_inner
998
1004
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
999
1005
#[ inline]
1000
1006
pub unsafe fn drop ( slot : & mut ManuallyDrop < T > ) {
You can’t perform that action at this time.
0 commit comments