Rollup merge of #125739 - RalfJung:drop-in-place-docs, r=workingjubilee · model-checking/verify-rust-std@1329a62 (original) (raw)

Original file line number Diff line number Diff line change
@@ -450,8 +450,13 @@ mod mut_ptr;
450 450
451 451 /// Executes the destructor (if any) of the pointed-to value.
452 452 ///
453 -/// This is semantically equivalent to calling [`ptr::read`] and discarding
453 +/// This is almost the same as calling [`ptr::read`] and discarding
454 454 /// the result, but has the following advantages:
455 +// FIXME: say something more useful than "almost the same"?
456 +// There are open questions here: `read` requires the value to be fully valid, e.g. if `T` is a
457 +// `bool` it must be 0 or 1, if it is a reference then it must be dereferenceable. `drop_in_place`
458 +// only requires that `*to_drop` be "valid for dropping" and we have not defined what that means. In
459 +// Miri it currently (May 2024) requires nothing at all for types without drop glue.
455 460 ///
456 461 /// * It is *required* to use `drop_in_place` to drop unsized types like
457 462 /// trait objects, because they can't be read out onto the stack and