Skip to content

Commit a445f23

Browse files
committed
review comment: further refinement of comment above fn is_adt_dtorck.
1 parent 34076bc commit a445f23

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/librustc/middle/ty/util.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,18 @@ impl<'tcx> ty::ctxt<'tcx> {
566566
}
567567
}
568568

569-
/// Returns true if this ADT is a dtorck type, i.e. whether it
570-
/// being safe for destruction requires all borrowed pointers
571-
/// reachable by it to have lifetimes strictly greater than self.
569+
/// Returns true if this ADT is a dtorck type.
570+
///
571+
/// Invoking the destructor of a dtorck type during usual cleanup
572+
/// (e.g. the glue emitted for stack unwinding) requires all
573+
/// lifetimes in the type-structure of `adt` to strictly outlive
574+
/// the adt value itself.
575+
///
576+
/// If `adt` is not dtorck, then the adt's destructor can be
577+
/// invoked even when there are lifetimes in the type-structure of
578+
/// `adt` that do not strictly outlive the adt value itself.
579+
/// (This allows programs to make cyclic structures without
580+
/// resorting to unasfe means; see RFCs 769 and 1238).
572581
pub fn is_adt_dtorck(&self, adt: ty::AdtDef<'tcx>) -> bool {
573582
let dtor_method = match adt.destructor() {
574583
Some(dtor) => dtor,

0 commit comments

Comments
 (0)