review comment: further refinement of comment above fn is_adt_dtorck.

This commit is contained in:
Felix S. Klock II 2015-10-09 18:42:14 +02:00
parent 34076bc0c9
commit a445f234a6

View File

@ -566,9 +566,18 @@ macro_rules! hash { ($e:expr) => { $e.hash(state) } }
}
}
/// 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,