Skip to content

Commit

Permalink
Rollup merge of rust-lang#45253 - Gankro:drop_docs, r=kennytm
Browse files Browse the repository at this point in the history
Clarify how needs_drop is conservative
  • Loading branch information
kennytm authored Oct 13, 2017
2 parents fb98e3e + 11775ab commit 8ea6790
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,11 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {

/// Returns whether dropping values of type `T` matters.
///
/// This is purely an optimization hint, and may be implemented conservatively.
/// For instance, always returning `true` would be a valid implementation of
/// this function.
/// This is purely an optimization hint, and may be implemented conservatively:
/// it may return `true` for types that don't actually need to be dropped.
/// As such always returning `true` would be a valid implementation of
/// this function. However if this function actually returns `false`, then you
/// can be certain dropping `T` has no side effect.
///
/// Low level implementations of things like collections, which need to manually
/// drop their data, should use this function to avoid unnecessarily
Expand Down

0 comments on commit 8ea6790

Please sign in to comment.