Be cautious of calling upvar_tys before mir

This commit is contained in:
Aman Arora 2020-11-07 01:04:27 -05:00 committed by Roxane
parent 5da2bf197d
commit e35e46c113
2 changed files with 136 additions and 110 deletions

View file

@ -94,16 +94,12 @@ where
_ if component.is_copy_modulo_regions(tcx.at(DUMMY_SP), self.param_env) => (),
ty::Closure(_, substs) => {
for upvar_ty in substs.as_closure().upvar_tys() {
queue_type(self, upvar_ty);
}
queue_type(self, substs.as_closure().tupled_upvars_ty());
}
ty::Generator(def_id, substs, _) => {
let substs = substs.as_generator();
for upvar_ty in substs.upvar_tys() {
queue_type(self, upvar_ty);
}
queue_type(self, substs.tupled_upvars_ty());
let witness = substs.witness();
let interior_tys = match witness.kind() {