Document that ManuallyDrop::drop should not called more than once
Double dropping is unsound (e.g. https://github.com/rust-lang/rust/issues/60977). This commit documents the fact that `ManuallyDrop::drop` should not be called multiple times on the same instance, as it might not be immediately obvious that this counts as a use of uninitialized data.
This commit is contained in:
parent
088b987307
commit
af96b1df1d
1 changed files with 2 additions and 1 deletions
|
|
@ -118,7 +118,8 @@ impl<T: ?Sized> ManuallyDrop<T> {
|
|||
///
|
||||
/// This function runs the destructor of the contained value and thus the wrapped value
|
||||
/// now represents uninitialized data. It is up to the user of this method to ensure the
|
||||
/// uninitialized data is not actually used.
|
||||
/// uninitialized data is not actually used, and that this function is called at most once
|
||||
/// for a given instance of ManuallyDrop
|
||||
///
|
||||
/// [`ManuallyDrop::into_inner`]: #method.into_inner
|
||||
#[stable(feature = "manually_drop", since = "1.20.0")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue