@@ -87,27 +87,28 @@ impl<T> ManuallyDrop<T> {
8787 slot. value
8888 }
8989
90- /// Takes the contained value out.
90+ /// Takes the value from the `ManuallyDrop<T>` container out.
9191 ///
9292 /// This method is primarily intended for moving out values in drop.
9393 /// Instead of using [`ManuallyDrop::drop`] to manually drop the value,
9494 /// you can use this method to take the value and use it however desired.
95- /// `Drop` will be invoked on the returned value following normal end-of-scope rules.
9695 ///
97- /// If you have ownership of the container, you can use [`ManuallyDrop::into_inner`] instead.
96+ /// Whenever possible, it is preferrable to use [`into_inner`][`ManuallyDrop::into_inner`]
97+ /// instead, which prevents duplicating the content of the `ManuallyDrop<T>`.
9898 ///
9999 /// # Safety
100100 ///
101- /// This function semantically moves out the contained value without preventing further usage.
102- /// It is up to the user of this method to ensure that this container is not used again.
101+ /// This function semantically moves out the contained value without preventing further usage,
102+ /// leaving the state of this container unchanged.
103+ /// It is your responsibility to ensure that this `ManuallyDrop` is not used again.
103104 ///
104105 /// [`ManuallyDrop::drop`]: #method.drop
105106 /// [`ManuallyDrop::into_inner`]: #method.into_inner
106107 #[ must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead" ]
107- #[ unstable ( feature = "manually_drop_take" , issue = "55422 " ) ]
108+ #[ stable ( feature = "manually_drop_take" , since = "1.42.0 " ) ]
108109 #[ inline]
109110 pub unsafe fn take ( slot : & mut ManuallyDrop < T > ) -> T {
110- ManuallyDrop :: into_inner ( ptr:: read ( slot) )
111+ ptr:: read ( & slot. value )
111112 }
112113}
113114
0 commit comments