about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlexis Beingessner <a.beingessner@gmail.com>2017-10-13 02:29:10 -0400
committerAlexis Beingessner <a.beingessner@gmail.com>2017-10-13 02:29:10 -0400
commit11775ab80dbbd39024d33cfa025e0bf2110f2ecc (patch)
tree3bc9f2d0616ba41d1b26124271e60031e9928e5b /src/libcore
parent91eb6fe56d6df4a66f11bd3e79f08f74aacbd164 (diff)
downloadrust-11775ab80dbbd39024d33cfa025e0bf2110f2ecc.tar.gz
rust-11775ab80dbbd39024d33cfa025e0bf2110f2ecc.zip
Clarify how needs_drop is conservative
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/mem.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 680a0f5b2c0..16d5fadc536 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -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