Don't collect into a Vec that is immediately being iterated on again.

This commit is contained in:
Oli Scherer 2021-08-10 11:03:10 +00:00
parent 7af445dc15
commit 93c4aa80b8

View File

@ -344,12 +344,11 @@ fn constrain_opaque_type<FRR: FreeRegionRelations<'tcx>>(
// check.)
let bounds = tcx.explicit_item_bounds(def_id);
debug!("{:#?}", bounds);
let bounds: Vec<_> =
bounds.iter().map(|(bound, _)| bound.subst(tcx, opaque_type_key.substs)).collect();
let bounds = bounds.iter().map(|(bound, _)| bound.subst(tcx, opaque_type_key.substs));
debug!("{:#?}", bounds);
let opaque_type = tcx.mk_opaque(def_id, opaque_type_key.substs);
let required_region_bounds = required_region_bounds(tcx, opaque_type, bounds.into_iter());
let required_region_bounds = required_region_bounds(tcx, opaque_type, bounds);
if !required_region_bounds.is_empty() {
for required_region in required_region_bounds {
concrete_ty.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {