Skip to content

Commit

Permalink
review comment: further refinement of comment above fn is_adt_dtorck.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Oct 9, 2015
1 parent 34076bc commit a445f23
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/librustc/middle/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a445f23

Please sign in to comment.