1
Fork 0

Always require Drop for generators.

This commit is contained in:
Camille GILLOT 2022-09-11 17:22:38 +02:00
parent 9259da51ed
commit 03618d6afd
3 changed files with 25 additions and 9 deletions

View file

@ -109,6 +109,13 @@ where
for component in components {
match *component.kind() {
// The information required to determine whether a generator has drop is
// computed on MIR, while this very method is used to build MIR. To avoid
// cycles, we consider that generators always require drop.
ty::Generator(..) if tcx.sess.opts.unstable_opts.drop_tracking_mir => {
return Some(Err(AlwaysRequiresDrop));
}
_ if component.is_copy_modulo_regions(tcx, self.param_env) => (),
ty::Closure(_, substs) => {