about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-10-09 18:42:14 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-10-09 18:42:14 +0200
commita445f234a64cdbbf946af012b94dccf91447b5ff (patch)
treef6882baffd3c430962bdeb65a302c26e08c5bfb5
parent34076bc0c9fb9ee718e1cebc407547eef730a080 (diff)
downloadrust-a445f234a64cdbbf946af012b94dccf91447b5ff.tar.gz
rust-a445f234a64cdbbf946af012b94dccf91447b5ff.zip
review comment: further refinement of comment above `fn is_adt_dtorck`.
-rw-r--r--src/librustc/middle/ty/util.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/librustc/middle/ty/util.rs b/src/librustc/middle/ty/util.rs
index 3d1eb66287f..a8f7a4db133 100644
--- a/src/librustc/middle/ty/util.rs
+++ b/src/librustc/middle/ty/util.rs
@@ -566,9 +566,18 @@ impl<'tcx> ty::ctxt<'tcx> {
         }
     }
 
-    /// Returns true if this ADT is a dtorck type, i.e. whether it
-    /// being safe for destruction requires all borrowed pointers
-    /// reachable by it to have lifetimes strictly greater than self.
+    /// Returns true if this ADT is a dtorck type.
+    ///
+    /// Invoking the destructor of a dtorck type during usual cleanup
+    /// (e.g. the glue emitted for stack unwinding) requires all
+    /// lifetimes in the type-structure of `adt` to strictly outlive
+    /// the adt value itself.
+    ///
+    /// If `adt` is not dtorck, then the adt's destructor can be
+    /// invoked even when there are lifetimes in the type-structure of
+    /// `adt` that do not strictly outlive the adt value itself.
+    /// (This allows programs to make cyclic structures without
+    /// resorting to unasfe means; see RFCs 769 and 1238).
     pub fn is_adt_dtorck(&self, adt: ty::AdtDef<'tcx>) -> bool {
         let dtor_method = match adt.destructor() {
             Some(dtor) => dtor,