Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b4c5471

Browse files
committed
Comment about generators and drops
1 parent 1917ffe commit b4c5471

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc/ty/util.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,9 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11241124

11251125
ty::TyClosure(def_id, ref substs) => substs.upvar_tys(def_id, tcx).any(needs_drop),
11261126

1127+
// Pessimistically assume that all generators will require destructors
1128+
// as we don't know if a destructor is a noop or not until after the MIR
1129+
// state transformation pass
11271130
ty::TyGenerator(..) => true,
11281131

11291132
ty::TyTuple(ref tys, _) => tys.iter().cloned().any(needs_drop),

0 commit comments

Comments
 (0)