about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-25 07:41:30 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-25 07:41:30 -0700
commitb4c54715cddc8f2e3fc8b420cc7c93ef55ae0d33 (patch)
tree7a03b20c79cd33584d509faaf6058374e9a8bef7
parent1917ffe314a0daf7a5df9c0186c05b22a5f89d59 (diff)
downloadrust-b4c54715cddc8f2e3fc8b420cc7c93ef55ae0d33.tar.gz
rust-b4c54715cddc8f2e3fc8b420cc7c93ef55ae0d33.zip
Comment about generators and drops
-rw-r--r--src/librustc/ty/util.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index 82810b7aae1..3adad7cf0f8 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -1124,6 +1124,9 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
         ty::TyClosure(def_id, ref substs) => substs.upvar_tys(def_id, tcx).any(needs_drop),
 
+        // Pessimistically assume that all generators will require destructors
+        // as we don't know if a destructor is a noop or not until after the MIR
+        // state transformation pass
         ty::TyGenerator(..) => true,
 
         ty::TyTuple(ref tys, _) => tys.iter().cloned().any(needs_drop),